Search code examples
imagemagickpnggifmogrify

Get first converted PNG file from GIF in ImageMagick


I'm trying to convert and resize GIF file to PNG file with Command :

mogrify.exe -define bmp:format=bmp3 -compress none -resize "300x200>" -antialias -format "png" -units PixelsPerInch -density 72 "img.gif"

But it's creating many images with postfix 0 to 31(img-0.png to img-31.png).

When I use '-flatten', I am getting merge single file but I just wanted first converted file (img-0.png).

Do we have any option for this?

GIF image : enter image description here

'-flatten' image : enter image description here

First Image : enter image description here

Thanks in advance!


Solution

  • When you specify img.gif[0] instead of img.gif only the first frame will be saved. And it looks like you also don't need the -define bmp:format=bmp3 because you are saving the file to png.