probably simple, but I don't understand!

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Ic3Knight

probably simple, but I don't understand!

Post by Ic3Knight »

Hi,

I'm pretty much a complete novice with imagemagick, so I hope someone out there can help me with this!

I'm doing some computer simulations and the output from the model is a series of .png images. I have used image magick in the past to convert these pngs to a single animated gif, which is nice and simple. Now, I want to select only a specific area of each image, scale that up a bit and then make a new gif of these enlargements... I've managed to do the crop and resize without problem to generate a second set of .pngs of the appropriate location in the original images. But when I convert this set of pngs to a gif, the resulting image retains the aspect ratio of the original set of images with the cut out section that I want sat in the middle... These are the commands I used:

convert stub*.png -crop 94x140+28+120 -resize 400 zoom%04d.png

and then

convert zoom*.png zoom.gif

but like I say, rather than getting a single gif with the dimensions of the "zoom*.png" images, I get one with an enlarged version of the original images, but with only grey except for where my cropped region was... what am I doing wrong? The individual zoom*.png images all have the correct ratio (400x596)...

Any advice would be greatly appreciated!

Thanks

Paul
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: probably simple, but I don't understand!

Post by Bonzo »

I have no experiance of this Paul but would it be something like -page http://www.imagemagick.org/script/comma ... s.php#page or -repage http://www.imagemagick.org/script/comma ... php#repage ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: probably simple, but I don't understand!

Post by anthony »

Bonzo is on the right track.. Add +repage after the -crop to remove the preserved virtual canvas information that teh GIF format is using.

Your animation is croped and reszied, but offset on a larger canvas in the GIF animation.

See IM Examples on Crop for general info on the prblem but also
http://www.imagemagick.org/Usage/anim_mods/#crop
which shows and explains the problem you see. The next set of examples explain another solution to reseting the virtual canvas information for more general (frame optimized) GIF animations.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply