The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

need help with imagemagick

D

dman_2007

Guest
I am using convert command with -resize option to resize uploaded images into small png images. The problem is that if anyone uploads an animated gif file, then the convert command outputs more then one png file (exact number depends on the number of frames in the animated gif file). Anyone knows how i can get it to output only one file? Preferably the first frame of the animated gif file resized according to the geometry specified on the command line.
 
Ok, found out how to do it.

convert inputfile[0] -resize 240x60 outputfile

works with image formats other than gif as well. The number in square bracket ( 0 in the command given above) is the frame number in the animated file. Frames are numbered starting from 0.
 
Last edited:
dman, does that resize using your code maintain "Aspect Ratio" or does it always (as in your quoted case( resize to a 4:1 width to height ration??
 
Aspect ratio is maintained, the geometry specified in the command specifies the maximum height and width. If you want to resize the image to that exact geometry without maintaining aspect ratio then append ! tio the geometry. For example,

convert inputfile[0] -resize 240x60! outputfile
 
banners
Back