Re: [Gimp-user] how to invert greyscale values only...
Rich Evans wrote: That's it! Perfect. glad to hear it works as expected. Just want to add that the programmer's route, aka doing it by the math, is quite viable, too. Some selected options: - the MathMap plugin probably enables the most concise solution: http://www.complang.tuwien.ac.at/schani/mathmap/ - with knowledge in C, it's not a big step to prototype using either Lua (the gluas plugin) or the built-in python-fu. - a plain C plugin gives the best processing speed at the price of the slowest development cycle. In lieu of being able to buy everyone who helped a round of beer, is there a way for me to show my gratitude to the GIMP community? Would a donation to GIMP help you guys? New contributors are always welcome! There are plenty of opportunities to help the project, by far it's not just about coding [1]. And posing useful problems here is already helpful, too. Of course, donations are always welcome [2]. regards, peter [1] http://www.gimp.org/develop [2] http://www.gimp.org/donating ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
Duplicate layer, invert bottom layer and cut all blacks and whites out of (transparent) top layer (of course, if there's a range of greys it gets more complicated). it's evident that this is the problem : i don't know about Rich's photo but the sample i use here have various flavors of blacks'. If it is not a simple Color2alpha should work to delete blacks and just add a white layer below :) i guess this is not the case :) Rich : Try Gmic ToolboxColorsReplace color select black as original and white as dest and play with smoothness. Is that good ? !! It's not working exactly the same as Gimp's replace color!! find gmic here : http://gmic.sourceforge.net/ this is a external filter addons with so many possibilities :) pygmee ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
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
Re: [Gimp-user] how to invert greyscale values only...
That's it! Perfect. Thanks Peter. (and my printer's black ink cartridge thanks you - heh heh) Not only is this an exact solution for my goal, but you have also taught me how to think more properly about the nature of the problem from the perspective of GIMP as a tool whereas I was coming at it from the brute force programmers way. Thanks everyone for helping me. I really appreciate it. In lieu of being able to buy everyone who helped a round of beer, is there a way for me to show my gratitude to the GIMP community? Would a donation to GIMP help you guys? -rich - Original Message From: yahvuu yah...@gmail.com To: Rich Evans reva...@yahoo.com Cc: Gimp-user@lists.XCF.Berkeley.EDU Sent: Thu, February 4, 2010 4:31:19 AM Subject: Re: [Gimp-user] how to invert greyscale values only... 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
Re: [Gimp-user] how to invert greyscale values only...
Ken --- close. but no cigar... the steps: 1) Colors - Desaturate; 2) Colors - Invert leaves me with a greyscale image... all color is gone :-( I'm looking for a filter that will invert only black, white and grey pixels... leaving color saturated pixels alone. Owen --- I will investigate the python solution. thanks for the advice. All --- Maybe the best question to ask is this... where online should I go to learn about how GIMP filters are developed? I suppose once I learn how to make on filter.. I suspect I will quickly conjure up other filter ideas as well... For completeness, my original question is this: I have an RGB image that is basically a black background with many colorful objects and white text. --- I'd like to invert the image so that it is a white background with black text but a simple invert inverts the colors in all the colored objects as well. 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). I could imagine a filter that does a simple RGB invert for any pixel whose calculated RGB saturation value is below a set threshold. Does this type of tool/script exist? continued thanks, -rich - Original Message From: Ken Warner kwarner...@verizon.net To: Rich Evans reva...@yahoo.com Cc: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 8:12:09 PM Subject: Re: [Gimp-user] how to invert greyscale values only... Colors - Desaturate; Colors - Invert No? Rich Evans wrote: I'm grateful for the replies I have received, but I was thinking that if there isn't a well-known tool or method already, that maybe someone could point me to a site that describes how custom filters can be made from scratch. I'm not afraid to learn what I need to to make the filter, ...I've just never done it before. *grin* I just need someone to point me to a decent tutorial (I can do c programming if that's what it is, but my working assumption is that, all things being equal, it should be easier to make a filter for GIMP than it would be to write a c program from scratch).Would anyone consider this... easy? continue thanks, -Rich - Original Message From: Cédric Gémy radar.ma...@free.fr To: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 5:58:51 PM Subject: Re: [Gimp-user] how to invert greyscale values only... not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
Rich Evans wrote: Ken --- close. but no cigar... the steps: 1) Colors - Desaturate; 2) Colors - Invert leaves me with a greyscale image... all color is gone :-( I'm looking for a filter that will invert only black, white and grey pixels... leaving color saturated pixels alone. Owen --- I will investigate the python solution. thanks for the advice. All --- Maybe the best question to ask is this... where online should I go to learn about how GIMP filters are developed? I suppose once I learn how to make on filter.. I suspect I will quickly conjure up other filter ideas as well... Meanwhile (and bearing in mind you haven't let us see the image in question), would this work?: Duplicate layer, invert bottom layer and cut all blacks and whites out of (transparent) top layer (of course, if there's a range of greys it gets more complicated). Andrew For completeness, my original question is this: I have an RGB image that is basically a black background with many colorful objects and white text. --- I'd like to invert the image so that it is a white background with black text but a simple invert inverts the colors in all the colored objects as well. 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). I could imagine a filter that does a simple RGB invert for any pixel whose calculated RGB saturation value is below a set threshold. Does this type of tool/script exist? continued thanks, -rich - Original Message From: Ken Warner kwarner...@verizon.net To: Rich Evans reva...@yahoo.com Cc: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 8:12:09 PM Subject: Re: [Gimp-user] how to invert greyscale values only... Colors - Desaturate; Colors - Invert No? Rich Evans wrote: I'm grateful for the replies I have received, but I was thinking that if there isn't a well-known tool or method already, that maybe someone could point me to a site that describes how custom filters can be made from scratch. I'm not afraid to learn what I need to to make the filter, ...I've just never done it before. *grin* I just need someone to point me to a decent tutorial (I can do c programming if that's what it is, but my working assumption is that, all things being equal, it should be easier to make a filter for GIMP than it would be to write a c program from scratch).Would anyone consider this... easy? continue thanks, -Rich - Original Message From: Cédric Gémy radar.ma...@free.fr To: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 5:58:51 PM Subject: Re: [Gimp-user] how to invert greyscale values only... not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only... leaving colors alone
On Mon, 2010-02-01 at 15:27 -0800, Rich Evans wrote: Hello, Is this the right place to ask a question about special filters in GIMP? If so, I'd love some advice on the following task: I have an RGB image that is basically a black background with many colorful objects and white text. --- I'd like to invert the image so that it is a white background with black text but a simple invert inverts the colors in all the colored objects as well. 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). I could imagine a filter that does a simple RGB invert for any pixel whose calculated RGB saturation value is below a set threshold. Does this type of tool/script exist? Simple. First create a duplicate of your layer. Then invert the colors on the lower layer and set the layer mode of the upper (unchanged) layer to Colors. Sven ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
I'm grateful for the replies I have received, but I was thinking that if there isn't a well-known tool or method already, that maybe someone could point me to a site that describes how custom filters can be made from scratch. I'm not afraid to learn what I need to to make the filter, ...I've just never done it before. *grin* I just need someone to point me to a decent tutorial (I can do c programming if that's what it is, but my working assumption is that, all things being equal, it should be easier to make a filter for GIMP than it would be to write a c program from scratch).Would anyone consider this... easy? continue thanks, -Rich - Original Message From: Cédric Gémy radar.ma...@free.fr To: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 5:58:51 PM Subject: Re: [Gimp-user] how to invert greyscale values only... not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
Colors - Desaturate; Colors - Invert No? Rich Evans wrote: I'm grateful for the replies I have received, but I was thinking that if there isn't a well-known tool or method already, that maybe someone could point me to a site that describes how custom filters can be made from scratch. I'm not afraid to learn what I need to to make the filter, ...I've just never done it before. *grin* I just need someone to point me to a decent tutorial (I can do c programming if that's what it is, but my working assumption is that, all things being equal, it should be easier to make a filter for GIMP than it would be to write a c program from scratch).Would anyone consider this... easy? continue thanks, -Rich - Original Message From: Cédric Gémy radar.ma...@free.fr To: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 5:58:51 PM Subject: Re: [Gimp-user] how to invert greyscale values only... not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only...
On Tue, 2 Feb 2010 16:54:09 -0800 (PST) Rich Evans reva...@yahoo.com wrote: I'm grateful for the replies I have received, but I was thinking that if there isn't a well-known tool or method already, that maybe someone could point me to a site that describes how custom filters can be made from scratch. I'm not afraid to learn what I need to to make the filter, ...I've just never done it before. *grin* I just need someone to point me to a decent tutorial (I can do c programming if that's what it is, but my working assumption is that, all things being equal, it should be easier to make a filter for GIMP than it would be to write a c program from scratch).Would anyone consider this... easy? continue thanks, -Rich - Original Message From: Cédric Gémy radar.ma...@free.fr To: Gimp-user@lists.XCF.Berkeley.EDU Sent: Tue, February 2, 2010 5:58:51 PM Subject: Re: [Gimp-user] how to invert greyscale values only... not completely satisfied with sven's method, working on some pictures but not any, depending on the shades. I used to do it in CMYK a long time ago with photoshop by just pushing the image to CMYK and inverting the K curve. I guess something might be done with decompose color filter or so. But the quicker/best average i've found is just adding a mask based on the layer (L from Lab or N form CMYK could be used too), and play with the curve to adapt to the shades+refine with brush on mask. It takes few seconds if the picture is not too complex. Then put a white layer below and it's quite done. But i'm not completely satisfied with it. If you look at http://www.gimp.org/tutorials/Color2BW/ I am pretty sure all those techniques can be scripted with with either scheme or python. Owen ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
[Gimp-user] how to invert greyscale values only... leaving colors alone
Hello, Is this the right place to ask a question about special filters in GIMP? If so, I'd love some advice on the following task: I have an RGB image that is basically a black background with many colorful objects and white text. --- I'd like to invert the image so that it is a white background with black text but a simple invert inverts the colors in all the colored objects as well. 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). I could imagine a filter that does a simple RGB invert for any pixel whose calculated RGB saturation value is below a set threshold. Does this type of tool/script exist? thanks! -Rich (revansx) ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Re: [Gimp-user] how to invert greyscale values only... leaving colors alone
Rich Evans wrote: I have an RGB image that is basically a black background with many colorful objects and white text. --- I'd like to invert the image so that it is a white background with black text but a simple invert inverts the colors in all the colored objects as well. 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). I could imagine a filter that does a simple RGB invert for any pixel whose calculated RGB saturation value is below a set threshold. Does this type of tool/script exist? Here's how I'd do this: First, I'd make a copy of the original image. Second, working with the copy, I'd add a new layer, filled with white, and move that layer to the bottom of the layer stack. Third, I'd make a copy of the original image, and move the copy to the top of the stack, if it doesn't happen to be there at the beginning. If necessary, I'd switch the color paletes so that black is the active color. Then I'd use the facility to select by color tool to select the white areas, making certain that there were not highlights of some of the many colorful objects which got included as well. I'd then paint or bucket fill as necessary to convert the formerly white areas to black. Fourth, returning to the original layer, I'd select all of the areas which are black, and remove them. Finally, merge the layers together, and you should have achieved the effect you wish. ns ___ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user