Skip to content

Instantly share code, notes, and snippets.

@mmb
Created January 11, 2011 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmb/773973 to your computer and use it in GitHub Desktop.
Save mmb/773973 to your computer and use it in GitHub Desktop.
convert image into retro 8-bit looking image
require 'RMagick'
# convert image intro retro 8-bit looking image
# http://matthewm.boedicker.org/
# find NES, SNES, etc. palette image on the web
palette = Magick::ImageList.new('/tmp/Palette_NTSC.png')
img = Magick::ImageList.new('/tmp/input.jpg')
orig_width, orig_height = img.columns, img.rows
img.remap(palette, Magick::NoDitherMethod)
img.scale!(0.10)
img.sample!(orig_width, orig_height)
img.write('/tmp/out.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment