ggboy: Retro ordered dithering camera simulator

View source: R/ggboy.R

ggboyR Documentation

Retro ordered dithering camera simulator

Description

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.

Usage

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
)

Arguments

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 = NULL (default = 1)

frame_data

a dataframe of x, y and z values as returned by image_to_frame() (default = NULL)

resize_filter

resize filter to be used magick::filter_types (default = 'Mitchell')

gravity

position of crop window relative to image (default = "center"). A string value from magick::gravity_types(). Values such as "south", "west", "northeast"

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

ggboy is meant to be a bit of fun. It performs a janky attempt at ordered dithering that is qualified only by what looks good to my eye. It is for artistic use only.

Value

A ggplot2 object


cj-holmes/ggboy documentation built on Sept. 17, 2024, 8:09 a.m.