trimImages | R Documentation |
This is a wrapper function around convert -trim
to automatically remove any
whitespace from locally saved images. Note that 'ImageMagick' must be
installed on your local system, see Source.
trimImages(path = ".", pattern = c(".png$", ".tiff$"))
path |
File path leading to image files as |
pattern |
A regular expression as |
A character
vector containing the names of the processed images.
Florian Detsch
Ooms J (2018) The magick package: Advanced Image-Processing in R. Available online: https://cran.r-project.org/package=magick/vignettes/intro.html.
system()
## Not run: ## trim image of bart simpson download.file("http://pngimg.com/uploads/simpsons/simpsons_PNG93.png?i=1" , destfile = (ofl <- file.path(tempdir(), "bart.png", fsep = "\\")) , mode = "wb") par(mfrow = c(1, 2)) img = brick(ofl) plotRGB(img) jnk = trimImages(tempdir(), "bart.png") trm = brick(jnk) plotRGB(trm) dev.off() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.