Batch crop multiple sprites while preserving midpoint
Posted: 2015-11-13T22:52:29-07:00
I have thousands of character sprites (though, really they're just PNG files with transparency) which were saved out from Maya, which is a 3D program.
These are character animations, with almost all of them being 12 frames each. Each animation is rendered from each of the 8 cardinal directions.
In each animation, the character is already centered in the frame (this is how it's exported from Maya); however, each image has extra transparent space around it that I'd like to crop down. (edit: to clarify, each source frame is PNG and contains the character only, and is on a transparent background)
I need to batch crop these sprites horizontally from the outside -> in order to preserve the character's "midpoint" in the frame. The reason for this is if it's not preserved, as the game swaps from one animation to the next, the character would appear to move or jump around. So, it's important the character is horizontally centered (using the midpoint of their body) in the frame across all their animations. Therefore, equal amounts have to be cropped from both the left and the right, if that makes sense.
Additionally... the character needs to be at or very near the bottom edge of the sprite.
For the coup de grace... the final cropped image needs to be an even number, or divisible by 2, for game engine reasons.
The source images are sequential PNG's (just single frames in order), and the newly cropped images need to be the same thing. I literally just need the cropping; no converting or anything like that. I don't need sprite sheets or anything like that.
Is there a way to go about doing this with IM? If it's complex, I'd be willing to pay someone to develop this. Thanks in advance!
These are character animations, with almost all of them being 12 frames each. Each animation is rendered from each of the 8 cardinal directions.
In each animation, the character is already centered in the frame (this is how it's exported from Maya); however, each image has extra transparent space around it that I'd like to crop down. (edit: to clarify, each source frame is PNG and contains the character only, and is on a transparent background)
I need to batch crop these sprites horizontally from the outside -> in order to preserve the character's "midpoint" in the frame. The reason for this is if it's not preserved, as the game swaps from one animation to the next, the character would appear to move or jump around. So, it's important the character is horizontally centered (using the midpoint of their body) in the frame across all their animations. Therefore, equal amounts have to be cropped from both the left and the right, if that makes sense.
Additionally... the character needs to be at or very near the bottom edge of the sprite.
For the coup de grace... the final cropped image needs to be an even number, or divisible by 2, for game engine reasons.
The source images are sequential PNG's (just single frames in order), and the newly cropped images need to be the same thing. I literally just need the cropping; no converting or anything like that. I don't need sprite sheets or anything like that.
Is there a way to go about doing this with IM? If it's complex, I'd be willing to pay someone to develop this. Thanks in advance!