Takes an image matrix from something like png::readPNG. Note that this cannot be saved out as jpeg as the lossy compression will drop the message

lsb_encode(content, img, force_object = FALSE)

lsb_decode(img)

Arguments

content

Content to save into the image; can be a text string or an arbitrary R object.

img

An image matrix to save the message into

force_object

Logical: Force saving a scalar text string as an R object (will be slightly more space efficient).

Author

Rich FitzJohn

Examples

img <- png::readPNG(system.file("img/Rlogo.png", package = "png")) txt <- "hello from stegasaur" img2 <- lsb_encode(txt, img) lsb_decode(img2)
#> [1] "hello from stegasaur"