RSS/Atom feed Twitter
Site is read-only, email is disabled

Re-hue-ing a graphic

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Re-hue-ing a graphic Jonathan Allen 09 Apr 18:05
  Re-hue-ing a graphic Michael J. Hammel 09 Apr 18:53
  Re-hue-ing a graphic Sven Neumann 10 Apr 07:49
9afbd5b90804090908h6df802d6... 07 Oct 20:19
  Re-hue-ing a graphic Jonathan Allen 09 Apr 18:51
   Re-hue-ing a graphic Michael J. Hammel 09 Apr 18:55
9afbd5b90804091004r3aa76a3c... 07 Oct 20:19
  Re-hue-ing a graphic Nathan Lane 09 Apr 19:08
   Re-hue-ing a graphic Nathan Lane 09 Apr 19:09
Jonathan Allen
2008-04-09 18:05:14 UTC (almost 17 years ago)

Re-hue-ing a graphic

Hi All,

Can anyone help me to do this? I look after a small on-line magazine and they have a mast-head logo at the top of several pages. This is in colour, but only different saturations of the same colour. Each month, the print-designer changes the colour of the text headlines and the mast-head to match.

I can always see the HTML colour selected (color=#XXXXXX) for the text and need to track the masthead colour to match. How do I get the Gimp to exactly track that hex colour - is there somewhere I can input it as a value and just it promulgated through the graphic at the existing saturation and lightness?

Jonathan

Jonathan Allen
2008-04-09 18:51:00 UTC (almost 17 years ago)

Re-hue-ing a graphic

Nathan,

When you click on the color on the Gimp tool dialog a color chooser dialog pops up and you can enter a hex value in the text field there. Is that what you mean?

Yes and no - it's exactly that sort of user-interface I am looking for, but to be able to set the hue of an existing graphic.

If I go into Layer-Colours-Hue/Saturation, then click 'Master', moving the 'Hue' slider bar alters the hue of the whole graphic (which is one single colour on a white background). I want to do this effect, with a colour chooser interface. Is that possible?

Jonathan

Michael J. Hammel
2008-04-09 18:53:56 UTC (almost 17 years ago)

Re-hue-ing a graphic

On Wed, 2008-04-09 at 17:05 +0100, Jonathan Allen wrote:

I can always see the HTML colour selected (color=#XXXXXX) for the text and need to track the masthead colour to match. How do I get the Gimp to exactly track that hex colour - is there somewhere I can input it as a value and just it promulgated through the graphic at the existing saturation and lightness?

You need to map the RGB values from the HTML to HSL. Manually, I'm not sure how to do this, but programmatically there is a function in libgimpcolor called gimp_rgb_to_hsl_int(gint *r, gint *g, gint *b) that will do this for you. You pass in the RGB values and you get back (in the same variables) the HSL values, repsectively. Once you have the HSL values you can call the Hue-Saturation tool via the PDB to apply to your masthead.

If you're writing a GIMP plugin in C, you just need to use "pkg-config --libs gimp-2.0" (on Fedora, other distros may use a different pkgconfig name for GIMP) to retrieve the libraries required for compiling your plugin. This will automatically include libgimpcolor.

You can probably do this in Script-Fu or Python, but I don't know those languages or their requirements. You can probably do it in Perl but I'm not sure if the Perl support was updated for GIMP 2.4 or not. I think it was, but it's not included in the standard distribution.

It's interesting that the Plugin Browser allows you to browse the APIs for the various plugins but there is nothing that lets you browse library calls that can be made directly from scripts or compiled plugins. There doesn't appear to be any documentation on this. I wonder if it's automatically generated by the build into HTML or man pages? The gimp_rgb_to_hsl_int() function is commented with what I think is a document formatting structure (looks kind of like javadoc). I just know about the function because I use cscope on the source code to find things.

Michael J. Hammel
2008-04-09 18:55:53 UTC (almost 17 years ago)

Re-hue-ing a graphic

On Wed, 2008-04-09 at 17:51 +0100, Jonathan Allen wrote:

If I go into Layer-Colours-Hue/Saturation, then click 'Master', moving the 'Hue' slider bar alters the hue of the whole graphic (which is one single colour on a white background). I want to do this effect, with a colour chooser interface. Is that possible?

Select the white background, then invert the selection and apply the hue changes.

Nathan Lane
2008-04-09 19:08:41 UTC (almost 17 years ago)

Re-hue-ing a graphic

On Wed, Apr 9, 2008 at 11:02 AM, Nathan Lane wrote:

OK, here are the steps I followed to do what I think you are trying to do.

1. Load you image
2. Using the dropper tool, click on the color on the image the was the old text color
3. Click on the Color in the Gimp Toolbox to open the color chooser 4. Note the H value (Hue at the top right of the color chooser) 5. Now type the hex value of the new text color into the text field on the color chooser
6. Note the H value (Hue) again
7. Subtract the old H-value from the new H-value 8. If the result is positive, subtract that amount from the Hue in the Hue-Saturation dialog under Colors, if it is negative, add that amount to the Hue in the Hue-Saturation dialog.

Tell me if you get lost of have any questions - it kinda makes sense, really.

Nathan

Nathan Lane
2008-04-09 19:09:22 UTC (almost 17 years ago)

Re-hue-ing a graphic

I might have gotten the add/subtract part mixed up in number 8, if so, it'll be obvious, just cancel and reverse the operation.

On Wed, Apr 9, 2008 at 11:08 AM, Nathan Lane wrote:

On Wed, Apr 9, 2008 at 11:02 AM, Nathan Lane wrote:

OK, here are the steps I followed to do what I think you are trying to

do.

1. Load you image
2. Using the dropper tool, click on the color on the image the was the old text color
3. Click on the Color in the Gimp Toolbox to open the color chooser 4. Note the H value (Hue at the top right of the color chooser) 5. Now type the hex value of the new text color into the text field on the color chooser
6. Note the H value (Hue) again
7. Subtract the old H-value from the new H-value 8. If the result is positive, subtract that amount from the Hue in the Hue-Saturation dialog under Colors, if it is negative, add that amount to the Hue in the Hue-Saturation dialog.

Tell me if you get lost of have any questions - it kinda makes sense, really.

Nathan

Sven Neumann
2008-04-10 07:49:11 UTC (almost 17 years ago)

Re-hue-ing a graphic

Hi,

On Wed, 2008-04-09 at 17:05 +0100, Jonathan Allen wrote:

Can anyone help me to do this? I look after a small on-line magazine and they have a mast-head logo at the top of several pages. This is in colour, but only different saturations of the same colour. Each month, the print-designer changes the colour of the text headlines and the mast-head to match.

Sounds like a job for the Colorize tool.

I can always see the HTML colour selected (color=#XXXXXX) for the text and need to track the masthead colour to match. How do I get the Gimp to exactly track that hex colour - is there somewhere I can input it as a value and just it promulgated through the graphic at the existing saturation and lightness?

The Colorize tool allows you to enter the Hue value directly. And you can easily find out the Hue by entering your hex color description in the Color selector dialog.

Sven