Hi --
Help, please! I have having a heck of a time getting convert to resize and pad out an image.
Centos 5.4.
ImageMagick.i386 0:6.2.8.0-4.el5_1.1
The background is staying black and the original image is not centered.
Original:
http://www.outdoorkids.com/images/swatc ... DN-BLK.jpg
Output
http://www.outdoorkids.com/images/swatc ... -BLK_1.jpg
Here is the command I used:
convert PAAAAAAAELALCFDN-BLK.jpg -resize 300X300 -background white -extent 300X300 -gravity center PAAAAAAAELALCFDN-BLK_1.jpg
Thank you,
-Ben
resizing and padding problem in Centos 5.4
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: resizing and padding problem in Centos 5.4
Your IM is too old. see http://www.imagemagick.org/Usage/crop/#extent
You need IM 6.3.2 or higher for -extent to recognize -background and -gravity. Also you should put -gravity before -extent.
As an alternate, you can create a white image of size 300x300 and composite your image over that white background using -gravity to center it.
see http://www.imagemagick.org/Usage/layers/#composite
or http://www.imagemagick.org/Usage/layers/#convert
convert \( -size 300x300 xc:white \) \( yourimage -resize 300x300 \) -gravity center -composite result
You need IM 6.3.2 or higher for -extent to recognize -background and -gravity. Also you should put -gravity before -extent.
As an alternate, you can create a white image of size 300x300 and composite your image over that white background using -gravity to center it.
see http://www.imagemagick.org/Usage/layers/#composite
or http://www.imagemagick.org/Usage/layers/#convert
convert \( -size 300x300 xc:white \) \( yourimage -resize 300x300 \) -gravity center -composite result
Re: resizing and padding problem in Centos 5.4
Makes me wonder why such an old version is included in Centos...? Regardless, thank you for the great advice! I spent hours trying to solve this and was up against a brick wall.
-Ben
-Ben
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: resizing and padding problem in Centos 5.4
Do a Google search and see if you can find a more current version with Centos or compatible with Centos.
Perhaps someone else or one of the IM folks can suggest where to find a more current upgrade
Perhaps someone else or one of the IM folks can suggest where to find a more current upgrade
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: resizing and padding problem in Centos 5.4
You can compile your own centos RPM from source.
http://www.imagemagick.org/Usage/api/#build
That makes it easier to upgrade and control the IM version that is installed.
CentOS is old not just for IM but for all packages. It's design criteria is as a stable server OS and thus uses older version that are known to work rather than bleeding edge versions that may have bugs.
http://www.imagemagick.org/Usage/api/#build
That makes it easier to upgrade and control the IM version that is installed.
CentOS is old not just for IM but for all packages. It's design criteria is as a stable server OS and thus uses older version that are known to work rather than bleeding edge versions that may have bugs.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: resizing and padding problem in Centos 5.4
Hi --
First, I'm a semi-newbie at all of this, so my apologies if I'm in need of a clue. That being said, I tried to install from source with some help from this guide that had already worked out some dependency issues: http://andrewduck.name/2009/01/imagemag ... -centos-5/
Attempt 1:
yum remove ImageMagick
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
wget ftp://ftp.imagemagick.org/pub/ImageMagi ... ick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.7-1/
./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes \
--with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
make clean
make
make install
After the make command, there were several warnings about dereferencing that may or may not be important. Example:
magick/distort.c:2399: warning: dereferencing type-punned pointer will break strict-aliasing rules
And, it finally died with:
magick/.libs/libMagickCore.so: undefined reference to `InstantiateXComponent'
collect2: ld returned 1 exit status
make[1]: *** [utilities/animate] Error 1
make[1]: Leaving directory `/usr/src/ImageMagick-6.5.7-1'
make: *** [all] Error 2
Attempt 2:
I removed the ImageMagick-6.5.7-1 directory, untarred again, and tried installing according to the instructions here: http://www.imagemagick.org/script/install-source.php with a simple ./configure and make. Same results.
I can certainly do the work around with the older version of ImageMagick that comes with Centos 5.4 (great info!), but would prefer to get this upgrade working -- not only so I learn something, but hopefully to benefit anyone else trying to do the same thing (btw, this thread has already been picked up by google). Any suggestions...?
Thanks again,
-Ben
First, I'm a semi-newbie at all of this, so my apologies if I'm in need of a clue. That being said, I tried to install from source with some help from this guide that had already worked out some dependency issues: http://andrewduck.name/2009/01/imagemag ... -centos-5/
Attempt 1:
yum remove ImageMagick
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
wget ftp://ftp.imagemagick.org/pub/ImageMagi ... ick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.7-1/
./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes \
--with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
make clean
make
make install
After the make command, there were several warnings about dereferencing that may or may not be important. Example:
magick/distort.c:2399: warning: dereferencing type-punned pointer will break strict-aliasing rules
And, it finally died with:
magick/.libs/libMagickCore.so: undefined reference to `InstantiateXComponent'
collect2: ld returned 1 exit status
make[1]: *** [utilities/animate] Error 1
make[1]: Leaving directory `/usr/src/ImageMagick-6.5.7-1'
make: *** [all] Error 2
Attempt 2:
I removed the ImageMagick-6.5.7-1 directory, untarred again, and tried installing according to the instructions here: http://www.imagemagick.org/script/install-source.php with a simple ./configure and make. Same results.
I can certainly do the work around with the older version of ImageMagick that comes with Centos 5.4 (great info!), but would prefer to get this upgrade working -- not only so I learn something, but hopefully to benefit anyone else trying to do the same thing (btw, this thread has already been picked up by google). Any suggestions...?
Thanks again,
-Ben
Re: resizing and padding problem in Centos 5.4
Edit magick/magick.c and comment out InstantiateXComponent:
- // InstantiateXComponent();