Extract/render an image from a zipfile into a bittermelon pixmap object
Source:R/zip_extract_bm_pixmap.R
zip_extract_bm_pixmap.Rdzip_extract_bm_pixmap() extracts/renders an image from a zipfile into a bittermelon::bm_pixmap() object.
Arguments
- zipfile
Path to a zip file
- filename
Filename within zip file
- ...
If
filenameis a pdf file then passed topdf_render_bm_pixmap()
Value
A bittermelon::bm_pixmap() object.
Examples
# Typically used with a print-and-play zip archive downloaded from
# e.g. <https://boardgamegeek.com/> but here we create our own zip file
if (requireNamespace("bittermelon", quietly = TRUE) &&
nzchar(Sys.which(Sys.getenv("R_ZIPCMD", "zip")))) {
input <- pdf_create_blank(bg = "blue")
zipfile <- tempfile(fileext = ".zip")
utils::zip(zipfile, input, flags = "-qj")
bm <- zip_extract_bm_pixmap(zipfile, basename(input), dpi = 75)
grid::grid.raster(bm)
unlink(c(input, zipfile))
}