Last active
March 3, 2017 07:24
-
-
Save mikezila/515c21bcec01d373d1ace15aa61b15db to your computer and use it in GitHub Desktop.
Replace "magic pink" with real transparency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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