Use ImageMagick within gimp
- Category:
Hi folks,
at the moment I'm investigating workflow possibilities for photos (mainly on linux). So there are programs for organizing and viewing, like digiKam, F-Spot and Geeqie, programs for editing, like dlRaw and gimp, and libraries (or commandline tools) like gmic and ImageMagick.
For my personal workflow I want the programs to interact, this means for example, I want one kind of tagging and rating, and this should be the same in all used applications... Another thing, I don't want to open a photo in several applications one after another, to get each step in one application done. This costs time, and it is very easy to loose metadata, color profiles or image quality (did I say time?).
For me there was one essential step missing. After editing in dlRaw some pictures need aditional work in gimp. Ok, thats no problem, just one click and the image is in gimp. But then when finished there, I need a resized version for the web... Ok resizing is possible in gimp, but when comparing the results I didn't like the builtin algorithms of gimp. So I always used ImageMagick's convert on the command line. So, save the image, navigate to the folder, open command line, typing the command with the right names... Not nice!
Finally I found a way to get rid of this. So, here is a python script for gimp, which saves a temporary file, calls an ImageMagick command on that file, passes the result to gimp and cleans everything up. This script calls the Lanczos resizing algorithm, which gives a sharp and clear resized version without any need to sharpen afterwards, if the original image was sharp (same method as in dlRaw). Exif data and color profile is preserved within the script.
Of course this script idea is much more flexible, one could builtin other functions from ImageMagick, or any commandline tool which can handle tiffs, or one could program ones own filters without the need for a gui, and use an adopted script for the gui...
Installing is easy, make sure you have python enabled in gimp (python in gimp for windows), then copy it to your local gimp plug-ins directory and set the file executable. Of course you need the ImageMagick package for your system (on linux it is most likely installed; on windows you have to download and install it manually). Finally on windows you have to change the path for mogrify in the script according to your installation, but this is not hard at all, just look in the file.
So, have fun with a new resizing method in gimp. Comments and further ideas are very welcome 
greets mike
UPDATE (03.02.2010): There is a new version of the script attached.
Trackback URL for this post:
| Attachment | Size |
|---|---|
| mm extern webresize.py_.txt | 4.33 KB |

Comments
Danke 2
Habe das Script gerade mal ausprobiert und habe gleich mal einen Vorschlag.
Du schreibst, dass Du den Lanczos Filter brauchst. Währe es möglich eine Auswahlbox mit verschieden Filtern, wie z.B Lanczos, Bicubic etc. einzufügen, somit könnte jeder selber entscheiden welche Filter für das gerade verwendete Foto am Besten ist.
Aber auf jedenfalls eine klasse Arbeit von Dir.
Gruss Mirco
Antwort
Danke dir.
Das einzubauen ist nicht schwer... Ich seh nur nicht ganz den Sinn darin, weil die anderen Verkleinerungsalgorithmen alle weniger scharf sind, und man möchte doch ein scharfes Bild fürs Web
Naja mal sehen ob ich die nächsten Tage etwas Zeit über hab...
Viele Grüße mike
Der Sinn..
darin ist dem User die Wahl zu lassen und nicht bei jedem Foto ist der Lancos Filter der beste, manchmal ist es damit einfach zu "scharf" nach dem verkleinern. Oder ich möchte nur selektiv etwas nachschärfen.
Etwas anderes ist mir noch aufgefallen. Mit dem Slider ist es zum Teil sehr schwer, die Grösse genau auszuwählen, ist es ev. auch noch möglich ein Eingabefeld für die Bildgrösse reinzubauen? Somit wird es etwas einfacher. Ich selber habe meine bevorzugte Bildgrösse unterdessen direkt im Code gewechselt.
Gruss Mirco
Danke
Genau auf so etwas habe ich schon lange gewartet.
Mensch bin ich froh.
Tausend Dank dafür.
Reply
Glad you like it. I haven't checked the code gimp uses, so I don't know the internal differences. I just didn't like the results it gave me, and I find the results of ImageMagick Lanczos pleasing... The differences are mainly in areas with small patterns which tend to moire artifacts.
greets mike
I installed this and found it
I installed this and found it interesting. (found the link on the flickr gimp forum). I'm wondering though, how this differs from the Lanczos interpolation that is already an option in the image resizing dialog on gimp? Nice job, though; this was the first python plugin I installed, so I had to install some other stuff to support python in gimp.
Post new comment