Date: February 9, 2018
According to a study by Yahoo Labs, “Filtered photos are 21 percent more likely to be viewed and 45 percent more likely to be commented on. Have you ever wondered how you could transform your images using filters similar to Instagram in R?
We present this package that performs digital image processing on .png images. It encompasses functions ranging from transformations like a simple flip, playing with color hues (rgb2gray) to 2D convolutions using a simple kernel matrix to do some interesting things! We have started with quite basic but diverse functions and hope to advance and add more with time.
This function performs convolution to de-emphasizes differences in adjacent pixel values. It has an averaging effect removing detail and noise resulting in blurring of the image.
This is a transformation function which flips the image either horizontally or vertically.
This function converts an RGB image to grayscale.
Non transparent background .png images required
Note: See Usage section below
"A picture paints a thousand words", however, a well-constructed image speaks even more than that without having to rely on a written description. We want to explore the elements of filters and their implementation in R. A similar package called "magick" exists in R which has standard filters like blur, sobel among others. We have started with a few basic functions but want to work towards building more advanced filters similar to the ones provided by Instagram.
To install InstaR
, follow these instructions:
devtools
has been installed. If not, open the console and input the following: install.packages("devtools")
to install devtools from CRAN. Also, check the package dependencies down below.devtools::install_github("UBC-MDS/InstaR", build_vignettes = TRUE)
Non transparent background .png images required
library(InstaR)
1.flip(input_path, direction, output_path)
Arguments:
input_path
: path to input imagedirection
: direction of flip. "h" (horizontal) or "v"(vertical)output_path
: path to output imageflip("./img.png", "h", "./img_flip.png")
2.blur(input_path, output_path)
Arguments:
input_path
: path to input imageoutput_path
: path to output imageblur("./img.png", "./img_blur.png")
3.greyscale(input_path, output_path)
Arguments:
input_path
: path to input imageoutput_path
: path to output imagegreyscale("./img.png", "./img_gs.png")
png
testit
tableMatrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.