convert/apple image colormap using GIMP gradient (ggr)?

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
teridon
Posts: 4
Joined: 2015-04-13T09:50:15-07:00
Authentication code: 6789

convert/apple image colormap using GIMP gradient (ggr)?

Post by teridon »

I'd like to apply a GIMP gradient color map (contained in a .ggr file) to an image, but can't figure out how to do it. I couldn't find this on the forum or via Google but maybe because I don't have the right jargon.

I tried using

Code: Select all

convert file.jpg -clut foo.ggr out.jpg
but it appears imagemagick doesn't understand the ggr format. ("no decode delegate for this image format `GGR'")

Do I need to create an actual image from the GGR so that "convert" understands it? I found many programs that convert an image to a ggr but not the other way around.

Example ggr file: https://github.com/Helioviewer-Project/ ... AIA304.ggr

Example source image (grayscale): http://i.imgur.com/tvOJKAj.jpg
Example desired result: http://i.imgur.com/JWcQmdm.jpg

If it matters, I'm using ImageMagick 6.9.0-6 Q16 x64 2015-02-07 on Windows 7 x64.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by fmw42 »

IM knows nothing about GIMP ggr files.

See Hald Clut at http://www.imagemagick.org/Usage/color_mods/#hald-clut

1. Create the base hald image in Imagemagick (use at least HALD:8)
2. Take it to GIMP and apply your colortable to the Hald image and save as 24-bit PNG (not JPG or any compressed format)
3. Bring the modified hald image back to IM and apply it using

Code: Select all

convert yourimage modifiedhaldimage.png -hald-clut resultimage
teridon
Posts: 4
Joined: 2015-04-13T09:50:15-07:00
Authentication code: 6789

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by teridon »

Thanks.

I created a base hald image via:

Code: Select all

convert hald:8 hald.png
Then I attempted to apply the color gradient. I opened it in GIMP, and used the "blend" tool to apply the desired gradient. (mode: normal, shape: linear). Then I exported it as PNG. This is the gradient map: http://i.imgur.com/YlGlqb5.jpg It doesn't really look like a clut any more so I imagine I did something wrong.

In any case, then I converted it using -hald-clut. The result is not at all what I expected. http://i.imgur.com/hluZ9vx.jpg

I also tried other blend modes (darken, additive, multiply, etc.). Some of these looked more like the hald color map, but still after using them with -hald-clut, none of them gave me the result I want -- and they all had the blocky appearance of the one above.

I suppose this is more a GIMP question than IM, so I can take this over to the GIMP forums... I'll report back if someone there tells me what I'm doing wrong.
teridon
Posts: 4
Joined: 2015-04-13T09:50:15-07:00
Authentication code: 6789

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by teridon »

I figured out what I was doing wrong in GIMP. Here are the complete steps in GIMP (assuming the ggr file is installed in your "gradients" folder)
  1. Open hald.png
  2. Select All
  3. In the Layers Dialog, select the Gradient Tool, then select the desired gradient
  4. Apply the gradient by selecting Colors -> Map -> Gradient Map
  5. Export the file by selecting File -> Export As ...
Then use -hald-clut as above.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by fmw42 »

Do NOT save the modified hald image as JPG or any compressed format or your result will be distorted due to the compression
teridon
Posts: 4
Joined: 2015-04-13T09:50:15-07:00
Authentication code: 6789

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by teridon »

Thanks for your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert/apple image colormap using GIMP gradient (ggr)?

Post by fmw42 »

You are welcome
Post Reply