Put a bird on it - Portlandia.
If you missed out on Portlandia, you should take some time to watch this clip of the “Put a bird on it” episode.
Just like Bryce and Lisa - we can put birds on anything with the magick
package from ROpenSci!
So let’s get started putting birds on things!
The magick
package is an R interface to the ImageMagick STL, one of the most comprehensive open source image processing libraries. It gives a lot of power to R users, and we’ll briefly cover the workflow before getting into our real example.
If you want a deeper dive on all the features of magick
, check out their awesome vignette!
# Load the library
library(magick)
# "read" in an image
dog <- image_read("https://images.pexels.com/photos/1564506/pexels-photo-1564506.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940")
image_info(dog)
format width height colorspace matte filesize density
1 JPEG 1880 1208 sRGB FALSE 87114 72x72
We can see a few things about the r_logo object, it is a .png, it’s height and width, filesize, and DPI/density.
We can also view the image in line.
print(dog)
format width height colorspace matte filesize density
1 JPEG 1880 1208 sRGB FALSE 87114 72x72