pnglitchr

pnglitchr is an R package that offers a thin wrapper around chikoski/png-glitch, a library to glitch PNG images.

Installation

To install this package, the Rust toolchain is required.

# remotes::install_github("paithiov909/pnglitchr")
install.packages("pnglitchr", repos = c('https://paithiov909.r-universe.dev', 'https://cloud.r-project.org'))

Examples

The following code shows how to glitch an image. The original image looks like this:

Original image
pkgload::load_all(export_all = FALSE)
#> ℹ Loading pnglitchr

fp <- system.file("images/barplot.png", package = "pnglitchr")
nr <-
  glitch_remove(fp, 0, 1) |>
  glitch_replace(20) |>
  glitch_apply(0, count_scanlines(fp), filter_type = "average") |>
  fastpng::read_png(type = "nativeraster")

grid::grid.newpage()
grid::grid.raster(nr, interpolate = FALSE)
Glitched image

Glitched image

License

MIT License.