ggboy | R Documentation |
ggboy
simulates the retro aesthetic of low resolution ordered image dithering cameras
Images are cropped (centrally by default) to have pixel dimensions of width = 128 and height = 112
A 16 pixel border is also applied to all sides, meaning the final output image will have width = 160 and height = 144
Final images consist of only 4 colours
ggboy
is meant to be a bit of fun. It makes an attempt at image dithering which may offend some experts/purists. This project is not an exact technical replication of anything - it's just what looks good to my eye.
ggboy(
img,
palette = c("#2e463d", "#385d49", "#577b46", "#7e8416"),
frame_colour = 1,
frame_data = NULL,
resize_filter = "Mitchell",
gravity = "center",
dither_spread = 0.25,
y_expansion = 0,
x_expansion = 0,
return_data = FALSE
)
img |
Path (or URL) to image file or object of class magick-image |
palette |
a character vector of 4 colours (default = c("#2e463d", "#385d49", "#577b46", "#7e8416")) |
frame_colour |
the index of the palette colour for the default blank frame. Only used if |
frame_data |
a dataframe of x, y and z values as returned by |
resize_filter |
resize filter to be used |
gravity |
position of crop window relative to image (default = "center"). A string value from |
dither_spread |
how much should the dithering 'spread'. Set to 0 for no dithering. (default = 0.25) |
y_expansion |
additive expansion to the image height (default = 0) |
x_expansion |
additive expansion to the image width (default = 0) |
return_data |
return the data for the image (no frame) rather than the plot
|
A ggplot2 object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.