embedJSON <- function(png.in, json.file, png.out) {
    txt <- scan(json.file,
                what = character(), strip.white = TRUE,
                quote = "'", blank.lines.skip = TRUE)
    metadata <- paste(txt, collapse = " ") %>% charToRaw() %>% memCompress() %>% as.character() %>% paste(collapse = "")
    metadata <- c(metaclip = metadata)
    img <- png::readPNG(source = png.in)
    # Embed compressed metadata
    png::writePNG(image = img,
                  text = metadata,
                  target = png.out)
}