On Apr 15, 2006, at 10:18 AM, bulia byak wrote:

Jon, I'm not interested in color _correction_ here. I just want to do

arbitrary wild things, such as select a complex drawing and desaturate

it, or shift its hue from green to purple, or decrease contrast. See?

I don't want no "profiles" (even temporary), I just want a simple and

straightforward and permanent color change.



But that's what is done.

LittleCMS lets you do much of that color changing, and if the source and destination buffer types are the same, you can even do it in-place.

In fact, that's exactly how I'm using it in sp-image.cpp

    guchar* currLine = px;                                                                                                                           
    for ( int y = 0; y < imageheight; y++ ) {                                                                                                        
        // Since the types are the same size, we can do the transformation in-place
        cmsDoTransform( transf, currLine, currLine, imagewidth );                                                                                    
        currLine += rowstride;                                                                                                                       
    }


In your case "shift its hue from green to purple" could be seen as just a 'profile' describing the color operation you want. *If* a 'temporary profile' matches the concept of what you need to do, and *if* the coding is straightforward, then you see that actually changing a buffer permanently is quite simple and straightforward.

Also... if you only want to change a given RGB color, then you just use that as a tiny "buffer" and change a single color. I've done that in code also.

However... if you need to change the actual source values of fills and gradients and such of items, then using LittleCMS is the best solution if those happen to have icc-color() set on them (which is getting added now). So for that point, the question is whether or not you need to change the paint specifications on the SVG items themselves, rather than only tweaking placed bitmap images. If it's the former, then I think you'd *have* to use LittleCMS to do those changes, otherwise you'll have to recreate the entire sourcebase for dealing with colorspaces other than sRGB.

Just ponder what "desaturate" might mean for an SVG drawing targeting a specific CMYK printer.