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

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                                    Principal Software Engineer
[EMAIL PROTECTED]                           http://graphics-muse.org
I personally do not believe in object orientation as a security model
(nor as a general programming paradigm), but feel free to try to
convince me. -- Linus Torvalds

Gimp-user mailing list

Reply via email to