joexv wrote:what i want to know is, is there a simpler way to do this via image magick?
A simpler way to do
what?
Only the top 1024 rows are relevant. "-crop x1024+0+0" will remove the stuff at the bottom. There are 10 panels across the image but the width is not divisible by 10. However, "-crop 10x8@" will chop it into panels. Then we can chop each panel into 3x4 sprites with "-crop 3x4@".
Code: Select all
convert ..\sprites.png -crop x1024+0+0 -crop 10x8@ -crop 3x4@ +repage p-%03d.png
"identify p*.png" tells us each sprite is 31 or 32 high, and 32 wide. Most sprites have 16 or fewer colours. A few have more.
We can make all sprites 32x32 pixels:
Code: Select all
convert ..\sprites.png -crop x1024+0+0 -crop 10x8@ -crop 3x4@ +repage -define distort:viewport=32x32+0+0 -filter box -distort SRT 1,0 p-%03d.png
We can reduce each one to 16 colours with "-colors 15". (Don't ask me why "15".)
Code: Select all
convert ..\sprites.png -crop x1024+0+0 -crop 10x8@ -crop 3x4@ +repage -define distort:viewport=32x32+0+0 -filter box -distort SRT 1,0 +dither -colors 15 p-%03d.png
After cropping into panels, you might want to do something about bad pixels at edges, caused by the panels being badly placed in the large image.