Created
January 10, 2012 14:33
-
-
Save ghostganz/1589361 to your computer and use it in GitHub Desktop.
Widening a PNG sprite on three places
This file contains 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' | |
original = ChunkyPNG::Image.from_file "original.png" | |
target = ChunkyPNG::Image.new(original.width + (355 * 3), original.height) | |
break_columns = [100, 310 + 100, 620 + 100] | |
target_x = 0 | |
(0...original.width).each do |x| | |
col = original.column(x) | |
if break_columns.include? x | |
356.times do | |
target.replace_column!(target_x, col) | |
target_x += 1 | |
end | |
else | |
target.replace_column!(target_x, col) | |
target_x += 1 | |
end | |
end | |
target.save "/tmp/success.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment