Reputation: 825
I want to make an animated gif from this frames .png image:
What I tried to do is resize it to a smaller image, split it into 4 parts, then make it animate. At first, I resize and split it with this command
mogrify -resize 140x140 -crop 2x2@ ps1.png
it seems worked well by returning 4 images, like this:
Now, I make them an animate gif with this:
convert -delay 25x100 -loop 0 ps1-*.png ps1.gif
But it returned this messed up image, instead of a cat crying:
Btw, When became an animated gif, the image seems more sharpen, is there anyway to prevent it?
Upvotes: 3
Views: 551
Reputation: 24419
The image in each corner is coming from the image page offset. You can view this by running the generated frames against the identify
utility.
identify ps1-*.png
# ps1-0.png PNG 70x46 140x92+0+0 8-bit sRGB 4.24KB 0.000u 0:00.009
# ps1-1.png[1] PNG 70x46 140x92+70+0 8-bit sRGB 4.26KB 0.000u 0:00.000
# ps1-2.png[2] PNG 70x46 140x92+0+46 8-bit sRGB 4.39KB 0.000u 0:00.000
# ps1-3.png[3] PNG 70x46 140x92+70+46 8-bit sRGB 4.64KB 0.000u 0:00.000
# ^^^ ^^ ^^ ^^
To resolve that issue, simply remove the paging offset by running the extracted images through +repage
.
mogrify +repage ps1-*.png
For Animating the GIF, ensure that you specify how you want the layers to be handled. In this example, I believe you would want to optimize-frame or plus. Dispose & coalesce can also be used to tweak the resulting animation.
convert -layers OptimizePlus -delay 25x100 ps1*.png -loop 0 ps1.gif
Upvotes: 2