1
votes

How do i reverse the frames of an sprite sheet with each frame of size 30x30 and horizontally aligned using Imagemagick?

Example:

http://i.stack.imgur.com/OIoYc.png ->>> http://i.stack.imgur.com/7WR9v.png (edited)

1
Are there always just two? Do you mean to reverse the order or to flip the entire sheet left to right? - Mark Setchell

1 Answers

3
votes

You can do that like this...

First, create three little 30x30 images in Red, Green and Blue:

convert -size 30x30! xc:red red.png
convert -size 30x30! xc:green green.png
convert -size 30x30! xc:blue blue.png

then append them side by side:

convert +append red.png green.png blue.png image.png

to get this:

enter image description here

Now crop that into 30x30 pixel frames, and reverse the order of the frames, then re-append them together into the output image.

convert -crop 30x30 image.png -reverse +append out.png

enter image description here

Note:

For future reference, if anyone wants to do the same thing but vertically instead of horizontally, just change +append to -append.