- install imagemagick
- download and unzip assets
identify npc5.png
In this, case we get that the image is 312x288
We visually count the number of rows and cols of characters.
In this case, it is 12 columns and 8 rows.
We visually calculate the dimensions of each character.
In this case, it is 16x32
We divide our dimensions by the rows and cols, which gives us:
312/12 = 26 pixels for the sprite's width
288/8 = 36 pixels for the sprite's height
Thus, we have a padding of 10 pixels to remove in the width of each character, and 4 pixels to remove in the height of each character.
we run:
convert npc5.png -crop 12x8@ +repage -gravity South -crop 16x36+0-4\! +repage parts-%d.png
or using a much more readable format, we run:
convert npc5.png -crop 12x8@ +repage -shave 5x0 -chop 0x4 parts-%d.png