Nothing
set.seed(2022)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Round trip to raster (with alpha)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_that("round trip from array works (with alpha)", {
im <- testthat::test_path("image/Rlogo-tiny.png")
arr <- fastpng::read_png(im, type = 'array')
# plot(as.raster(arr), interpolate = FALSE)
nr <- array_to_nr(arr)
# plot(nr)
arr2 <- nr_to_array(nr)
# plot(as.raster(arr2), interpolate = FALSE)
attr(arr2, "class") <- NULL
expect_identical(arr, arr2)
})
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Round trip to raster (without alpha)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_that("round trip from array works (without alpha)", {
im <- testthat::test_path("image/Rlogo-tiny.png")
arr <- fastpng::read_png(im, type = 'array')
arr <- arr[,,1:3]
# plot(as.raster(arr), interpolate = FALSE)
nr <- array_to_nr(arr)
# plot(nr)
arr2 <- nr_to_array(nr)
# plot(as.raster(arr2), interpolate = FALSE)
attr(arr2, "class") <- NULL
expect_identical(arr, arr2[,,1:3])
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.