Con­vert an ani­mated gif to sequence of pdf files.
Now you can scale and rotate the images and keep their full pix­elized beauty.



FILE=$1
BGCOLOR=88FF99
 
convert -adaptive-resize 300% \ -interpolate integer \ +antialias -coalesce \ $FILE resize.gif
 
mv resize.gif coalesce.gif
 
HSIZE=`identify coalesce.gif | \ cut -d " " -f 3 | \ head -1 | cut -d "x" -f 1` VSIZE=`identify coalesce.gif | \ cut -d " " -f 3 | \ head -1 | cut -d "x" -f 2` HADD=`expr \( 400 - $HSIZE \) / 2` VADD=`expr \( 400 - $VSIZE \) / 2`
 
convert -scene 1 +adjoin \ -bordercolor \#${BGCOLOR} \ -border ${HADD}x${VADD} \ -gravity center \ coalesce.gif \ ${FILE%%.*}_%03d.gif
 
for FRAME in `ls ${FILE%%.*}_*.gif` do autotrace -background-color=$BGCOLOR \ -corner-threshold 100 \ -corner-always-threshold 200 \ -corner-surround 1 \ -report-progress \ -output-file=${FRAME%%.*}.pdf \ $FRAME rm $FRAME done; rm coalesce.gif exit 0;