I'm trying to make sprite sheets out of animated gifs. The sprites are for my GPS, and each frame needs to be exactly 80x80 pixels.
I used this command:
convert -resize 80x80 input.gif g.png
which will give you N number of frames of a gif, enumerated like: g-N.png.
What I realized using the power of gimp is that the images have been scaled at some point, which is what I don't want. Shown in the attached picture, is an 80x80px section, where the following sprite over lays the area which is supposed to only be the first sprite.
The very next line in my script is:
convert +append g-*.png $outputFile
which may have a roll in this... I'm not sure.
Complete script source-code:
#!/bin/bash
#set -vx
# Takes an image via an argument, converts it to the sprite style my gps takes.
# PNG image must be exactly 2880x150 or 2881x160 pixels in size. individual sprites, ar 80x80 px
mkdir -p test2
rm test2/*.png
n=`identify -format "%n\n" $1 | head -1`
m=`expr $n / 2`
outputFile=out`date +%s`.png
#outputFile=out.png
echo "N: " + $n
echo "M: " + $m
convert -resize 80x80 $1 test2/g.png
convert +append test2/g-*.png $outputFile
#convert -resize 2880x150 $outputFile
#montage test2/g-$m.png $outputFile
Ok, I think I got it, Thanks to this Unix & Linux stack Exchange post, and reading about the extend function on imagemagick's website.
All my backgrounds are transparent, so that the dancing girl in this case, doesn't cover the map. Extend is a Direct Image Size Adjustment, where extra space is filled with a color or transparency, and excess is truncated.
I changed the first convert command to:
my output now conforms to the layout requirements: