hi, Rich Evans wrote: > [..] Is there a > technique or tool to invert any part of the image that is only a shade of > grey? > i.e. invert pixeils with a saturation of ~0 (if that is how you say > it).
The on-board tools are just fine for this. "Do something to some pixels (here: invert) and leave the rest unchanged" translates to: duplicate the layer, do that something and apply a suitable layer mask. Where the layer mask is white, the modified pixels from the top layer are visible, otherwise the unchanged pixels from the bottom layer show through. So a layer mask is needed which equates the image's saturation, such that it is white (= show inverted pixels) where the saturation is zero (or close to zero). The saturation gets calculated during conversion to the HSV color model: Color->Components->Decompose delivers a "saturation" layer. The lighter this layers is, the more saturation the corresponding image pixel has. In consequence, it must be inverted. To further mask out image pixels, which are not close to a saturation of 0, a threshold of 254 can be applied. (More on that later). Using this layer as a layer mask for the "inverted" layer will reveal wether this train of thought is correct... The steps: 1. Create inverse copy of picture Duplicate the picture layer Invert that new layer 2. Create HSV color separation Select picture layer and do Colors->Components->Decompose ("color model HSV"), which creates a new image. Copy the "saturation" layer to your original image. (simply drag the layer from the layers dialog to the image window.) Invert that new layer (for better finetuning, we'll do the thresholding later) 3. Turn saturation layer into a layer mask for the inverted picture <crude hack> somebody please help out and insert a sane way to copy a layer to another layer's mask With saturation layer: Add Layer Mask ("Grayscale copy of layer") Mask to Selection Delete the saturation layer (all required information is in the selection mask) With the "inverted picture" layer: Add Layer Mask ("Selection") Select->None </crude hack> now we're basicly done 4. Fine-tuning of layer mask Select newly created layer mask According to the question, now a Colors->Threshold of 254 should be applied, but Color->Levels and dragging the middle slider to the right gives better control. Don't expect the saturation mask to be perfect, some rounding errors due to 8bit resolution might show up. have fun, peter _______________________________________________ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user