Talkback for article: 211, July2001

Do magic with images on the shell

Back to:

From: Atif <atif(at)> [ date: 2001-06-24 ]
nice article Katja,
Perhaps there should be another article on using PerlMagick (perl binding for ImageMagic).
Using PerlMagic you can do nifty things such as creating images on the fly etc.

We once used PerlMagic to create businesscards for users.

From: Katja <katja(at)> [ date: 2001-07-23 ]
Hi Todd!
Thanks a lot! I will correct it in the article!
From: Roger <roger(at)> [ date: 2001-07-24 ]
always wondered what imagemagick was!

always have used "tHE GiMp!". since then, always have wished to
see Gimp to gain the ability of the same commandline utils as such as ImageMagick
From: Arne <cal_43spanish(at)> [ date: 2001-07-24 ]
Guter Artikel,
ich habe mich immer gefragt wozu imagemagick eigentlich
gut ist.
Nach dem Artikel werde ich ihm noch mal eine Chance geben.
MfG Arne
From: Bertrand Zidler <bzidler(at)> [ date: 2001-08-13 ]
When using convert to reduce the size of a jpeg image, you can specify the final width and height, or only the width and let convert adjust the height keeping the same proportions. For instance for a 1152x864 picture
convert -geometry 288x216 im.jpg im_small.jpg and convert -geometry 288 im.jpg im_small.jpg should give the same result. And actually you get nearly the same pictures, but the 2 files can be of a slightly different size.
From: Frederik <fhimpe(at)> [ date: 2001-09-05 ]
I've got a question concerning Bertrand Zidler's remark: Is it also possible to make thumbnails by specifying only the height, so that the width is adjusted automatically to keep the same proportions?
From: Rienk <rienk(at)> [ date: 2001-10-08 ]
I want to know if there is an article about imagemagick in combination with php. Maybe you know something about it?

From: Andre Dubuc <aajdubuc(at)> [ date: 2001-10-23 ]
Thanks for the timely article. I had been scrounging around for some utility to convert tif to jpg since I had over 200 files to do! Had some problem with the code until I read another article on Perl by Guido (I'm a real newbie at writing code - my only experience has been with Paradox!).

Your article is excellent. I needed a replacement for a Win app to generate thumbnails. Can't wait to try yours!

I wondered about the "f in $* ;do" - glad I read Talkback!

Blessings & regards.
From: Axel <axel_vogelsang(at)> [ date: 2002-09-14 ]
Hello Katja

I'm a webdesigner/macuser with a graphic background and just recently with the the arrival of OS X I started to dig into shell commands, Apache, PHP and MYSQL. I've installed imagemagick and get it running with simple commands such as convert. But then the problems start:
1. I don't get your scripts running. In the shell I go to the folder where the script is saved together with the images and type mksmallimage. The answer I get is "command not found".
2. For the HTML: Could one really just copy and paste those scripts into an HTML page to get them running? And this would then generate the changes on the fly?

It would be great if you could give a newbie some hints. Thanks a lot.

From: guido [ date: 2002-09-17 ]
Hi Axel,
type ./mksmallimage instead of mksmallimage. You don't have
the current working directory (".") in your path ($PATH).
If you would have used the example from the article
with absolute path (/home/katja/mksmallimage or maybe
/home/axel/somewhere/mksmallimage) then it would have also worked.

I am not sure what you mean with question 2.
From: Floris <floris-(at)-linuxfocus-(dot)-org> [ date: 2002-09-27 ]
Axel, Guido, I understaind question 2.
Axel wants to have a dynamic HTML page, that uses a script to generate the HTML, probably for a thumbnail gallery or something similar.
Well Axel, no, it's not really possible to cut and past. Because when you paste the script in an HTML file, it is no longer a script but plain text.
You have to 'activate' this code.
One way to do that is to use SSI, Server Side Includes.
That way you could put a SSI command in your webpage, and the SSI enabled webserver (Apache) would recognise the command, execute it, and transfer the generated HTML code to the HTML page.
But, I think ImageMagick is just too slow to use in auto-generated webpages.
Pheew, that was a long comment :-)
From: kimderiy [ date: 2003-04-25 ]
i love your work a lot
From: katja socher [ date: 2003-07-24 ]
Please note that ImageMagick has changed a bit
since I wrote this article.
The basic ideas are still the same and you should still be able
to use most of the commands as shown in the article.
The combine command is now called composite.

From: Oliver Doepner [ date: 2004-11-20 ]
To find out the width or height of an image without using sed use

identify -format "%w" <image-filename>
identify -format "%h" <image-filename>


14 talkbacks in English
Other talkbacks:   Portugues Francais

Due to the increased amount of web spam we have deciced to removed the talkback posting possibility. You can read old talkbacks but you can no longer post new ones.

Back to

Please contact webmaster(at) if you have any questions with regards to this talkback

lftalkback version 3.10