Advanced Graphics and Image-Processing in R

Bindings to 'ImageMagick': the most comprehensive open-source image processing library available. Supports many common formats (png, jpeg, tiff, pdf, etc) and manipulations (rotate, scale, crop, trim, flip, blur, etc). All operations are vectorized via the Magick++ STL meaning they operate either on a single frame or a series of frames for working with layers, collages, or animation. In RStudio images are automatically previewed when printed to the console, resulting in an interactive editing environment. The latest version of the package includes a native graphics device for creating in-memory graphics or drawing onto images using pixel coordinates.



  • Ignore attribute warnings in image_read() instead of error (fixes #134)
  • New functions image_threshold() and image_lat(), tnx Jan Wijffels
  • New functions image_hough_draw() and image_hough_txt()
  • New function image_morphology()
  • New function image_fx() (Jan Wijffels #138)
  • Knitr is now a Suggests package instead of Imports (#150)
  • Set magick temp dir via C instead of env vars
  • Add 'tibble' class to df returned by image_info()
  • Added a rep() method for images


  • New function image_attributes()
  • MacOS: new autobrew script uses prebuilt static bottle


  • Export image_read_svg() and image_read_pdf()
  • Add image_raster() (thanks Thomas for the hint)
  • Vectorize and add 'fuzz' parameter to image_compare()
  • Added image_ggplot() with examples of using magick + ggplot2
  • Added 'pseudo_image' parameter to image_blank()


  • Several fixes for IM7, mostly related to alpha channels
  • Images rendered in knitr/rmarkdown are now stored in 'figures' (#108)
  • Add support for displaying images in Jupyter notebook
  • Export example images: logo, wizard, rose, granite
  • Better mapping of R internal colors to proper RGB strings
  • Added image_orient() to (auto) orient image
  • Add 'density' to image_info()
  • Fixes for Solaris


  • Automatically repage transformations that may modify image size
  • Added image_repage() to be consistent with command line tool
  • image_composite() now vectorizes over both 1st and 2nd argument
  • Support EBImage S4 Image class in image_read() and as_EBImage()
  • Fix a bug where 1 channel image array would read as 'Green' instead of 'Gray'
  • Include alpha channel in as.raster() for magick images
  • Export image_data() function to export raw bitmap data
  • Round the clipping coordinates to fix problem with 1px edge around graphics
  • Reset clipping area when magick graphics device is closed or starts new page
  • Change default colorspace for image_quantize() to RGB which is safer
  • Breaking: 'fuzz' parameter rescaled to be a percentage (0-100)
  • Add image_strip() as well as 'strip = TRUE' paremeter to image_read()
  • Adding image_blank() to create empty images
  • Graphics device: hardcode font aliases for families used by R, issue #80
  • Better font family lookup in graphics and image_annotate()
  • Switch to DrawableRotation() api for rotation in text and graphics
  • Autobrew: build gdk-pixbuf without modules (for rendering svg with rasters)
  • New functions option_types() and option_values() to list possible options
  • Drop support for GraphicsMagick (it never really worked)
  • RStudio viewer: convert to png for unsupported formats


  • Add knit_print.magick-image() method so that images automatically appear in knitr docs
  • Adding vignette examples for image_modulate() and image_convolve()


  • Windows/OSX: update imagemagick fixes a rare png writing bug
  • Set MAGICK_TMPDIR to match R session tempdir() instead of global TMPDIR
  • Explicitly set channels in image_negate() for IM7 compatibility
  • Added image_channel() to extract a single channel from an image
  • Added new image_convolve() function


  • Automatically import + export magrittr::%>% for easy pipelining
  • Fix 'zero-configuration' in magick_config() to use the proper macro
  • BREAKING: image_compare() now returns an image with a 'distortion' attribute
  • Workaround for broken std::string(Magick::Color) in GCC-7


  • Documentation! Split manuals into meaningful pages
  • Windows / MacOS: update ImageMagick to 6.9.9-9 (fixes a png bug and one for linejoins)
  • Added image_modulate() for setting brightness, saturation, hue
  • Added image_quantize() option for reducing number of colors in an image
  • Added image_resize() which supports custom resize filters
  • image_border() now takes a operator parameter, fixes transparency bug
  • image_write() gains a parameter 'comment' to add metadata to the file
  • image_convert() gain 'type' and 'colorspace' parameters e.g. to convert to grayscale
  • image_animate() has been merged with image_coalesce()


  • Change default 'bg' in image_graph() to 'white'
  • Fix positioning of rasterImage() when raster image is rotated
  • Use TriangleFilter for interpolating rasterImage()
  • Improve support for 'symbol' fonts (metrics are still not 100%)
  • Rotate text using affine transformations
  • image_composite() gains a 'composite_args' parameter needed for e.g. blend
  • Fix support for demo images e.g. image_read("wizard:") or image_read("logo:")


  • Vectorize image_draw() (all drawing should be applied to each frame)
  • Rename 'image_device' to 'image_graph'
  • Add 'antialias' parameter to image_graph() and image_draw() and image_convert()
  • New function image_apply() to apply a transformation to each frame individually
  • New function image_ocr() for easy text extraction
  • Added image_despeckle(), image_median(), image_reducenoise() (tnx Noam Ross)
  • image_background() now flattens each frame by default
  • Support dev.capture() for in image_graph() and image_draw() device
  • Support type nativeRaster, raster, and matrix in image_read()
  • Drawing rasters reimplemented DrawableCompositeImage()
  • OSX: Fix performance issue with font caching
  • Windows: Fix performance issue with font rendering
  • Windows: Add back support for gcc-4.6.3 on Windows


  • NEW: native graphics device for producing images! See ?magick_device
  • NEW: easy drawing on top of images using magick_draw()
  • Windows: updated build to 6.9.9-3
  • Various fixes to support upcoming IM7 (IM6 is still recommended)
  • Update vignette with new features


  • Extract autobrew script


  • Add [<-.magick-image to support for assigning layers to image by index
  • Revert Windows build to ImageMagick 6 because IM7 is too buggy
  • Add plot(image) method
  • Added intro vignette


  • Try again to fix the mac binary package
  • Switch the Windows package to ImageMagick 7


  • Try to fix the mac binary package


  • Build binary package on macOS --with-zero-configuation (fixes "config xml file" errors).
  • image_read now reads straight from disk rather than via R.
  • Add as.raster() method for images
  • image_write gains a 'flatten' argument
  • Lots of small tweaks here and there


  • Initial CRAN release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.7.3 by Jeroen Ooms, 4 months ago (website) (devel)

Report a bug at

Browse source code at

Authors: Jeroen Ooms [aut, cre]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports Rcpp, magrittr, curl

Suggests av, spelling, jsonlite, methods, knitr, rmarkdown, rsvg, webp, pdftools, ggplot2, gapminder, IRdisplay, tesseract, gifski

Linking to Rcpp

System requirements: ImageMagick++: ImageMagick-c++-devel (rpm) or libmagick++-dev (deb)

Imported by MtreeRing, PoPdesign, ROMDB, UniprotR, add2ggplot, animation, basemaps, bookdownplus, carbonate, chronochrt, colocr, colorizer, daiR, doconv, eoffice, figpatch, fsbrain, gdiff, ggfx, ggimage, gm, handwriter, iconr, image.binarization, image.textlinedetector, imagefluency, kerastuneR, mapboxapi, mapscanner, mathpix, meme, metaDigitise, moveVis, multipanelfigure, openSkies, pathfindR, pavo, plothelper, protein8k, r4lineups, splashr, summarytools, svgtools, terrainr, texPreview, tidycharts, tvthemes, vprr, zoomGroupStats.

Depended on by LearnClust, LearningRlab, huito, magickGUI.

Suggested by IBMPopSim, IsoriX, MetaIntegrator, Rediscover, WSGeometry, arcpullr, cmcR, cowplot, dlib, exams, facerec, fairadapt, fitbitViz, flextable, gdalcubes, gganimate, ggpp, ggtikz, glow, gridGraphics, gridpattern, hexSticker, hypervolume, image.CannyEdges, image.ContourDetector, image.CornerDetectionF9, image.CornerDetectionHarris, image.LineSegmentDetector, image.Otsu, image.dlib, image.libfacedetection, imager, imgpalr, imgrec, isoband, kableExtra, knitr, lime, mem, memapp, memery, modelsummary, nCov2019, phangorn, piecepackr, popdemo, rayimage, rayshader, rayvertex, recogito, rgee, rgl, ricu, roundhouse, rsvg, rtweet, simEd, simulariatools, spiralize, tesseract, tfhub, torchvision, usethis, x3ptools.

See at CRAN