Skip to content

Instantly share code, notes, and snippets.

@mikezila
Last active March 3, 2017 07:24
Show Gist options
  • Save mikezila/515c21bcec01d373d1ace15aa61b15db to your computer and use it in GitHub Desktop.
Save mikezila/515c21bcec01d373d1ace15aa61b15db to your computer and use it in GitHub Desktop.
Replace "magic pink" with real transparency
require 'chunky_png'
#replaces magic-pink with actual transparency
img = ChunkyPNG::Image.from_file(ARGV.first)
img.height.times do |y|
img.width.times do |x|
img[x,y] = 0x00000000 if img[x,y] == 0xff00ffff
end
end
img.save('trans_' + ARGV.first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment