ImageMagick 6.2.7 and background/gravity

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
Rule

ImageMagick 6.2.7 and background/gravity

Post by Rule »

Hello,

I'm having problems with the following command:
convert /var/www/html/ocmwbm00/admin/pdf2swf/tmp/easystar.pdf -resize 400x400 -background white -gravity center -extent 400x400 /var/www/html/ocmwbm00/admin/pdf2swf/tmp/easystar%d.gif

I call this instruction through the exec command in php.

This is our version of imagemagick:
Version: ImageMagick 6.2.7 07/26/06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

An example:
I have an image of 800*600. After resize this is 400*300 since I want to keep the aspect ratio. However the actual image has to be 400*400. Therefore I want a background colored white and I want to position the result image in the center of my new image. I have a multipage pdf that I want to convert to a multipage gif.

My result however is an image of 400*400 with a black background and a result image positioned in the top left corner.
Any ideas?


Kind regards,
Roel
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick 6.2.7 and background/gravity

Post by fmw42 »

I just looked on the examples page for extent and found this for you:

Before IM version v6.3.2, "-extent" just cleared the memory of any new areas to zero, or straight black. It did not fill the areas with "-background" color. Also after IM v6.3.2, "-extent" will use the "-gravity" to define where any new areas

So give my alternate method using -composite a try that I sent you by private message.

Fred
Post Reply