{"id":15165,"date":"2020-03-10T00:11:52","date_gmt":"2020-03-09T23:11:52","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?p=15165"},"modified":"2020-03-11T07:38:21","modified_gmt":"2020-03-11T06:38:21","slug":"easy-image-processing-in-r-using-the-magick-package","status":"publish","type":"post","link":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/","title":{"rendered":"Easy Image Processing in R using the Magick Package"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article describes how to perform <strong>image processing in R<\/strong> using the <strong>magick R package<\/strong>, which is binded to <code>ImageMagick<\/code> library: the most comprehensive open-source image processing library available.<\/p>\n<p>The magick R package supports:<\/p>\n<ul>\n<li>Many common formats: png, jpeg, tiff, pdf, etc<\/li>\n<li>Different manipulations types: rotate, scale, crop, trim, flip, blur, etc.<\/li>\n<\/ul>\n<p>All operations are vectorized using the <code>Magick++ STL<\/code> meaning they operate either on a single frame or a series of frames for working with layers, collages, or animation.<\/p>\n<p>In RStudio images are automatically previewed when printed to the console, resulting in an interactive editing environment.<\/p>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#installation\">Installation<\/a><\/li>\n<li><a href=\"#load-the-package\">Load the package<\/a><\/li>\n<li><a href=\"#formats-supported-by-imagemagick-on-your-system\">Formats supported by ImageMagick on your system<\/a><\/li>\n<li><a href=\"#image-editing-read-write-and-convert-images\">Image editing: Read, Write and Convert images<\/a><\/li>\n<li><a href=\"#image-transformations\">Image transformations<\/a>\n<ul>\n<li><a href=\"#cut-and-edit\">Cut and edit<\/a><\/li>\n<li><a href=\"#text-annotations\">Text annotations<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#layers\">Layers<\/a>\n<ul>\n<li><a href=\"#stack-layers-on-top-of-each-other\">Stack layers on top of each other<\/a><\/li>\n<li><a href=\"#combining-or-appending-images\">Combining or appending images<\/a><\/li>\n<li><a href=\"#create-gif-animation\">Create GIF animation<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#read-more\">Read more<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"installation\" class=\"section level2\">\n<h2>Installation<\/h2>\n<ul>\n<li><strong>For Mac OS or Windowns<\/strong>:<\/li>\n<\/ul>\n<pre class=\"r\"><code>install.packages(\"magick\")<\/code><\/pre>\n<ul>\n<li><strong>For Linux, you can install from source<\/strong><\/li>\n<\/ul>\n<ol style=\"list-style-type: decimal;\">\n<li>Install system requirements:<\/li>\n<\/ol>\n<pre class=\"bash\"><code>sudo apt-get install -y libmagick++-dev<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li>Install the R package<\/li>\n<\/ol>\n<pre class=\"r\"><code>install.packages(\"magick\")<\/code><\/pre>\n<\/div>\n<div id=\"load-the-package\" class=\"section level2\">\n<h2>Load the package<\/h2>\n<pre class=\"r\"><code>library(magick)<\/code><\/pre>\n<\/div>\n<div id=\"formats-supported-by-imagemagick-on-your-system\" class=\"section level2\">\n<h2>Formats supported by ImageMagick on your system<\/h2>\n<pre class=\"r\"><code>str(magick::magick_config())<\/code><\/pre>\n<pre><code>## List of 21\r\n##  $ version           :Class 'numeric_version'  hidden list of 1\r\n##   ..$ : int [1:4] 6 9 6 6\r\n##  $ modules           : logi FALSE\r\n##  $ cairo             : logi TRUE\r\n##  $ fontconfig        : logi TRUE\r\n##  $ freetype          : logi TRUE\r\n##  $ fftw              : logi FALSE\r\n##  $ ghostscript       : logi FALSE\r\n##  $ jpeg              : logi TRUE\r\n##  $ lcms              : logi FALSE\r\n##  $ libopenjp2        : logi FALSE\r\n##  $ lzma              : logi TRUE\r\n##  $ pangocairo        : logi TRUE\r\n##  $ pango             : logi TRUE\r\n##  $ png               : logi TRUE\r\n##  $ rsvg              : logi TRUE\r\n##  $ tiff              : logi TRUE\r\n##  $ webp              : logi TRUE\r\n##  $ wmf               : logi FALSE\r\n##  $ x11               : logi FALSE\r\n##  $ xml               : logi TRUE\r\n##  $ zero-configuration: logi TRUE<\/code><\/pre>\n<\/div>\n<div id=\"image-editing-read-write-and-convert-images\" class=\"section level2\">\n<h2>Image editing: Read, Write and Convert images<\/h2>\n<p><strong>Key R functions<\/strong>:<\/p>\n<pre class=\"r\"><code>image_read(path, density = NULL, depth = NULL, strip = FALSE)\r\n\r\nimage_write(image, path = NULL, format = NULL, quality = NULL,\r\n  depth = NULL, density = NULL, comment = NULL, flatten = FALSE)\r\n\r\nimage_convert(image, format = NULL, type = NULL, colorspace = NULL,\r\n  depth = NULL, antialias = NULL)<\/code><\/pre>\n<p>The input image file format can be a file path, URL, or raw vector with image data.<\/p>\n<p><strong>Read an image into R<\/strong>.<\/p>\n<pre class=\"r\"><code>frink &lt;- image_read(\"https:\/\/jeroen.github.io\/images\/frink.png\")\r\n## print(frink)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-frink.png\" alt=\"Example of image\" \/><\/p>\n<pre class=\"r\"><code># Shows some meta data about the image\r\nimage_info(frink)<\/code><\/pre>\n<pre><code>##   format width height colorspace matte filesize\r\n## 1    PNG   220    445       sRGB  TRUE    73494<\/code><\/pre>\n<p><strong>Export an image in any format to a file on disk<\/strong>. You can specify the <code>format<\/code> parameter to convert the image to another format.<\/p>\n<pre class=\"r\"><code># Render png to jpeg\r\nimage_write(frink, path = \"frink.jpg\", format = \"jpeg\", quality = 75)<\/code><\/pre>\n<div class=\"success\">\n<p>If <code>path<\/code> is a filename, <code>image_write<\/code> returns <code>path<\/code> on success such that the result can be piped into function taking a file path.<\/p>\n<\/div>\n<p><strong>Convert image formats<\/strong>. You can internally convert the image to another format earlier, before applying transformations. This can be useful if your original format is lossy.<\/p>\n<pre class=\"r\"><code>frink_jpeg &lt;- image_convert(frink, \"jpeg\")\r\nimage_info(frink_jpeg)<\/code><\/pre>\n<pre><code>##   format width height colorspace matte filesize\r\n## 1   JPEG   220    445       sRGB  TRUE        0<\/code><\/pre>\n<div class=\"notice\">\n<p>Note that size is currently 0 because ImageMagick is lazy (in the good sense) and does not render until it has to.<\/p>\n<\/div>\n<p><strong>Image preview<\/strong>.<\/p>\n<ul>\n<li>Magick images are automatically displayed in RStudio viewer<\/li>\n<li>You can also use <code>image_browse()<\/code> to open the image in your system\u2019s default application for a given type.<\/li>\n<li>On Linux you can use <code>image_display()<\/code> to preview the image in an X11 window.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-preview.png\" alt=\"Images preview\" \/><\/p>\n<\/div>\n<div id=\"image-transformations\" class=\"section level2\">\n<h2>Image transformations<\/h2>\n<div id=\"cut-and-edit\" class=\"section level3\">\n<h3>Cut and edit<\/h3>\n<p>Several of the transformation functions take an <code>geometry<\/code> parameter which requires a special syntax of the form <code>AxB+C+D<\/code> where each element is optional. Some examples:<\/p>\n<ul>\n<li><code>image_trim(image)<\/code>: Trims margin.<\/li>\n<li><code>image_crop(image, geometry = \"100x150+50\")<\/code>: crop out <code>width:100px<\/code> and <code>height:150px<\/code> starting <code>+50px<\/code> from the left<\/li>\n<li><code>image_scale(image, geometry = \"200\")<\/code>: resize proportionally to width: <code>200px<\/code><\/li>\n<li><code>image_scale(image, grometry = \"x200\")<\/code>: resize proportionally to height: <code>200px<\/code><\/li>\n<li><code>image_fill(image, color = \"blue\", point = \"+100+200\")<\/code>: flood fill with blue starting at the point at <code>x:100, y:200<\/code><\/li>\n<li><code>image_border(frink, color = \"red\", geometry = \"20x10\")<\/code>: adds a border of 20px left+right and 10px top+bottom<\/li>\n<\/ul>\n<p>Change image border and background:<\/p>\n<pre class=\"r\"><code># Add 20px left\/right and 10px top\/bottom\r\nimage_border(image_background(frink, \"hotpink\"), \"#000080\", \"20x10\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-change-border-and-background.png\" alt=\"Change image border and background\" \/><\/p>\n<p>Trim margins:<\/p>\n<pre class=\"r\"><code>image_trim(frink)<\/code><\/pre>\n<p>Crop the image. Options are here <code>width:100px<\/code> and <code>height:150px<\/code> starting <code>+50px<\/code> from the left<\/p>\n<pre class=\"r\"><code>image_crop(frink, \"100x150+50\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-crop.png\" alt=\"Crop an image\" \/><\/p>\n<p>Resize the image:<\/p>\n<pre class=\"r\"><code># Width: 300px\r\nimage_scale(frink, \"300\") \r\n# Height: 300px\r\nimage_scale(frink, \"x300\") <\/code><\/pre>\n<p>Rotate or mirror the image<\/p>\n<pre class=\"r\"><code>image_rotate(frink, 45)\r\nimage_flip(frink)\r\nimage_flop(frink)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-rotate-or-mirror.png\" alt=\"Rotate or miror images\" \/><\/p>\n<p>Modulate and paint an image:<\/p>\n<pre class=\"r\"><code># Change the brightness, the saturation and the Hue\r\nimage_modulate(frink, brightness = 80, saturation = 120, hue = 90)\r\n\r\n# Paint the shirt in blue\r\nimage_fill(frink, \"blue\", point = \"+100+200\", fuzz = 20)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-modulate-and-paint-images.png\" alt=\"Modulate and paint images\" \/><\/p>\n<p>With <code>image_fill<\/code> we can flood fill starting at pixel <code>point<\/code>. The <code>fuzz<\/code> parameter allows for the fill to cross for adjacent pixels with similarish colors. Its value must be between 0 and 256^2 specifying the max geometric distance between colors to be considered equal. Here we give professor frink a blue shirt.<\/p>\n<\/div>\n<div id=\"text-annotations\" class=\"section level3\">\n<h3>Text annotations<\/h3>\n<pre class=\"r\"><code># Add some text\r\nimage_annotate(\r\n  frink, text = \"I like R!\", size = 70, color = \"green\",\r\n  gravity = \"southwest\"\r\n  )\r\n\r\n# Customize text\r\nimage_annotate(\r\n  frink, text = \"CONFIDENTIAL\", size = 30, \r\n  color = \"red\", boxcolor = \"pink\",\r\n  degrees = 60, location = \"+50+100\",\r\n  font = \"Times\"\r\n  )<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-text-annotations.png\" alt=\"Text annotations\" \/><\/p>\n<p>Fonts that are supported on most platforms include <code>\"sans\"<\/code>, <code>\"mono\"<\/code>, <code>\"serif\"<\/code>, <code>\"Times\"<\/code>, <code>\"Helvetica\"<\/code>, <code>\"Trebuchet\"<\/code>, <code>\"Georgia\"<\/code>, <code>\"Palatino\"<\/code>or <code>\"Comic Sans\"<\/code>.<\/p>\n<\/div>\n<\/div>\n<div id=\"layers\" class=\"section level2\">\n<h2>Layers<\/h2>\n<div id=\"stack-layers-on-top-of-each-other\" class=\"section level3\">\n<h3>Stack layers on top of each other<\/h3>\n<p>Import and scale images:<\/p>\n<pre class=\"r\"><code>bigdata &lt;- image_read('https:\/\/jeroen.github.io\/images\/bigdata.jpg')\r\nfrink &lt;- image_read(\"https:\/\/jeroen.github.io\/images\/frink.png\")\r\nlogo &lt;- image_read(\"https:\/\/jeroen.github.io\/images\/Rlogo.png\")\r\nimg &lt;- c(bigdata, logo, frink)\r\nimg &lt;- image_scale(img, \"300x300\")\r\nimage_info(img)<\/code><\/pre>\n<pre><code>##   format width height colorspace matte filesize\r\n## 1   JPEG   300    225       sRGB FALSE        0\r\n## 2    PNG   300    232       sRGB  TRUE        0\r\n## 3    PNG   148    300       sRGB  TRUE        0<\/code><\/pre>\n<p>Print images:<\/p>\n<pre class=\"r\"><code># Prints images on top of one another\r\nimage_mosaic(img)\r\n\r\n# Create a single image which has the size of the first image\r\nimage_flatten(img)\r\n\r\n# Adding images\r\nimage_flatten(img, 'Add')\r\n\r\n# Modulate images\r\nimage_flatten(img, 'Modulate')\r\n\r\n# Minus\r\nimage_flatten(img, 'Minus')<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-stack-layers.png\" alt=\"Stack layers\" \/><\/p>\n<\/div>\n<div id=\"combining-or-appending-images\" class=\"section level3\">\n<h3>Combining or appending images<\/h3>\n<p>Put the image frames next to each other:<\/p>\n<pre class=\"r\"><code>image_append(image_scale(img, \"x200\"))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-append.png\" alt=\"Append Images\" \/><\/p>\n<p>Stack images on top of each other:<\/p>\n<pre class=\"r\"><code>image_append(image_scale(img, \"100\"), stack = TRUE) <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-append-and-stack.png\" alt=\"Stack Images\" \/><\/p>\n<p>Composing allows for combining two images on a specific position:<\/p>\n<pre class=\"r\"><code>bigdatafrink &lt;- image_scale(image_rotate(image_background(frink, \"none\"), 300), \"x200\")\r\nimage_composite(image_scale(bigdata, \"x400\"), bigdatafrink, offset = \"+180+100\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-composite.png\" alt=\"Image processing\" \/><\/p>\n<\/div>\n<div id=\"create-gif-animation\" class=\"section level3\">\n<h3>Create GIF animation<\/h3>\n<p>Animating image frames:<\/p>\n<pre class=\"r\"><code>image_animate(image_scale(img, \"200x200\"), fps = 1, dispose = \"previous\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-animate.png\" alt=\"Gif animation\" \/><\/p>\n<p>Creates a sequence of <code>n<\/code> images that gradually morph one image into another.<\/p>\n<pre class=\"r\"><code>newlogo &lt;- image_scale(image_read(\"https:\/\/jeroen.github.io\/images\/Rlogo.png\"))\r\noldlogo &lt;- image_scale(image_read(\"https:\/\/developer.r-project.org\/Logo\/Rlogo-3.png\"))\r\nimage_resize(c(oldlogo, newlogo), '200x150!') %&gt;%\r\n  image_background('white') %&gt;%\r\n  image_morph() %&gt;%\r\n  image_animate()<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/image-processing-in-r-animate-morph.gif\" alt=\"Gif animation and Morth\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"read-more\" class=\"section level2\">\n<h2>Read more<\/h2>\n<ul>\n<li><a class=\"uri\" href=\"https:\/\/docs.ropensci.org\/magick\/\">https:\/\/docs.ropensci.org\/magick\/<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to perform image processing in R using the magick R package, which is binded to ImageMagick library: the most comprehensive open-source image processing library available. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":15166,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rating_form_position":"","rating_results_position":"","mr_structured_data_type":"","footnotes":""},"categories":[352],"tags":[],"class_list":["post-15165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-image-processing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Easy Image Processing in R using the Magick Package - Datanovia<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Easy Image Processing in R using the Magick Package - Datanovia\" \/>\n<meta property=\"og:description\" content=\"This article describes how to perform image processing in R using the magick R package, which is binded to ImageMagick library: the most comprehensive open-source image processing library available. The [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-09T23:11:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-11T06:38:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png\" \/>\n\t<meta property=\"og:image:width\" content=\"220\" \/>\n\t<meta property=\"og:image:height\" content=\"445\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Alboukadel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alboukadel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\"},\"author\":{\"name\":\"Alboukadel\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\"},\"headline\":\"Easy Image Processing in R using the Magick Package\",\"datePublished\":\"2020-03-09T23:11:52+00:00\",\"dateModified\":\"2020-03-11T06:38:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\"},\"wordCount\":561,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png\",\"articleSection\":[\"Image Processing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\",\"name\":\"Easy Image Processing in R using the Magick Package - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png\",\"datePublished\":\"2020-03-09T23:11:52+00:00\",\"dateModified\":\"2020-03-11T06:38:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png\",\"width\":220,\"height\":445,\"caption\":\"Example of image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Easy Image Processing in R using the Magick Package\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\",\"name\":\"Alboukadel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"caption\":\"Alboukadel\"},\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Easy Image Processing in R using the Magick Package - Datanovia","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/","og_locale":"en_US","og_type":"article","og_title":"Easy Image Processing in R using the Magick Package - Datanovia","og_description":"This article describes how to perform image processing in R using the magick R package, which is binded to ImageMagick library: the most comprehensive open-source image processing library available. The [&hellip;]","og_url":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/","og_site_name":"Datanovia","article_published_time":"2020-03-09T23:11:52+00:00","article_modified_time":"2020-03-11T06:38:21+00:00","og_image":[{"width":220,"height":445,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png","type":"image\/png"}],"author":"Alboukadel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alboukadel","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#article","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/"},"author":{"name":"Alboukadel","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e"},"headline":"Easy Image Processing in R using the Magick Package","datePublished":"2020-03-09T23:11:52+00:00","dateModified":"2020-03-11T06:38:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/"},"wordCount":561,"commentCount":1,"publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png","articleSection":["Image Processing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/","url":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/","name":"Easy Image Processing in R using the Magick Package - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png","datePublished":"2020-03-09T23:11:52+00:00","dateModified":"2020-03-11T06:38:21+00:00","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2020\/03\/image-processing-in-r-frink.png","width":220,"height":445,"caption":"Example of image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/blog\/easy-image-processing-in-r-using-the-magick-package\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"Easy Image Processing in R using the Magick Package"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e","name":"Alboukadel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","caption":"Alboukadel"},"url":"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/"}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/15165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=15165"}],"version-history":[{"count":3,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/15165\/revisions"}],"predecessor-version":[{"id":15192,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/15165\/revisions\/15192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/15166"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=15165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/categories?post=15165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/tags?post=15165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}