Page 1 of 1
Duplicating GIMP results in IM
Posted: 2010-04-26T16:51:09-07:00
by gregster
I'd like to tone-down the saturation of a series of map images that look like this:
http://hcmc.uvic.ca/people/greg/mff_screen_original.png
so they look something like this:
http://hcmc.uvic.ca/people/greg/mff_screen_adjusted.png
I made the changes using the GIMP Colours > Hue-Saturation... menu (I've exported the settings I used as a preset:
http://hcmc.uvic.ca/people/greg/gimpHSL5.txt); basically, I change the saturation and lightness levels for each channel.
What I need to do is change about 17 million other files to match, and I figured IM was the way to go. I looked at a great many helpful sites that explain the use of various parameters (e.g.
http://www.imagemagick.org/Usage/color/#color_mods) but I admit that it leaves me a bit confused.
Can anyone help me convert the GIMP preset to an IM script?
Re: Duplicating GIMP results in IM
Posted: 2010-04-26T16:58:51-07:00
by fmw42
I don't think that IM has any function that works the same way as GIMP. I think the best thing would be to play with IM -modulate in each of HSL or HSB mode until you get something acceptably close and then use those settings with mogrify to process whole folders of images.
Actually it does not look like -modulate is what you need. Perhaps better would be to create a HALD color image (see
http://www.imagemagick.org/Usage/color/#hald-clut). then process that with your GIMP settings in GIMP. Then bring the processed HALD image back to IM and use -hald-clut to apply it to your images using mogrify so that it works on a whole directory of images. Test with convert on one image first.
Alternately, though probably not as good, process a grayscale gradient image with your GIMP settings and then use IM -clut to apply that to your images. In either case, use your example image as a test.
Let us know if either of these work out.
Re: Duplicating GIMP results in IM
Posted: 2010-04-26T18:36:17-07:00
by snibgo
Why not write is as a Gimp script?
Re: Duplicating GIMP results in IM
Posted: 2010-04-27T09:49:58-07:00
by fmw42
Actually I made a mistake in my comments above. You probably cannot use mogrify because it will not allow the hald lut image. So you will need to write a script to loop over all your files to apply the hald lut with convert.
Re: Duplicating GIMP results in IM
Posted: 2010-04-27T14:08:07-07:00
by gregster
Thanks for the quick replies:
To clarify, I actually *do* have 17 million files. I'd like to offload this to a CLI box with some HP and let it trundle away as long as it needs. Installing X is not an option, so the GIMP is out.
After a good deal of frustration I noticed that hald-clut isn't supported until 6.5.3-4 and Karmic has an earlier version installed. After a fresh install of a more up-to-date IM I was able to create the hald image using:
"convert hald:8 adjusted_image.png hald-palette.png"
which gave me a starting point. I tried running "convert original_image.png hald-palette.png -hald-clut adjusted_image.png" and ended up with a not-quite-there image. I made some saturation/hue/lightness changes to the hald-palette.png with the GIMP and after a few tries I got it.
Next up is creating a little bash script to do the batch processing, but that should be no problem.
Thanks for the help!
Re: Duplicating GIMP results in IM
Posted: 2010-04-27T14:27:23-07:00
by snibgo
Apparently Q8 is around 20% faster than Q16, which might be significant to you (4 months instead of 5).
Re: Duplicating GIMP results in IM
Posted: 2010-04-27T21:41:21-07:00
by anthony
gregster wrote:After a fresh install of a more up-to-date IM I was able to create the hald image using:
"convert hald:8 adjusted_image.png hald-palette.png"
But this does not adjust the halk image! It created a identify HALD, and loads another image then tries to save two images! hald-palette-0.png (the identity hald) and hald-palette-1.png the other image you loaded.
You need to process the hald image to change the colors within to the colors desired. Only then can the hald image be used to modify other images.
See IM Examples, HALD color lookup table images.
http://www.imagemagick.org/Usage/color/#hald-clut
NOTE that HALD lookuptables can NOt handle any form of transparency.
Re: Duplicating GIMP results in IM
Posted: 2010-04-28T10:20:06-07:00
by gregster
Thanks for the explanation. I think I inadvertently got there on my own.
I realized that the hald image that I created didn't contain the scheme I wanted, so I adjusted it in the GIMP. The resulting hald "palette" was close enough to my expected result that I'm calling it a success.
It's going to take me a while to wrap my brain around IM - it's capacity (and complexity) is a bit of a mind-blower at first.