tests/testthat/test_load_save_images.R

library(imager)
library(Rcpp)

cimg.limit.openmp()

test_that("load_and_save_images",{
    im <- imfill(10,10,val=c(0,0,0))
     
    ff <- tempfile(fileext=".png")
    save.image(im,ff)
    im2 <- load.image(ff)
    unlink(ff)
    expect_equal(im,im2)
})

Try the imager package in your browser

Any scripts or data that you put into this service are public.

imager documentation built on May 31, 2023, 8:56 p.m.