Dialecticus Posted October 28, 2011 Share Posted October 28, 2011 I have an icon that has only colors between black and white and an alpha channel. I would like to replace the black part into, say, green, so that icon has color range from green to white, and retains its alpha channel. Adding one opaque green layer and fiddling with blend modes did not produce results, because then transparency is gone. Recolor tool is close, but does not recolor all pixels, even when tolerance is set to 100%. This task should be easy, but I gave up after two hours of trying. What should I do? Quote Link to comment Share on other sites More sharing options...
BoltBait Posted October 28, 2011 Share Posted October 28, 2011 I have an icon that has only colors between black and white and an alpha channel. I would like to replace the black part into, say, green, so that icon has color range from green to white, and retains its alpha channel. Adding one opaque green layer and fiddling with blend modes did not produce results, because then transparency is gone. Recolor tool is close, but does not recolor all pixels, even when tolerance is set to 100%. This task should be easy, but I gave up after two hours of trying. What should I do? Look for a plugin called Grim Color Reaper. Or, you could place an all green layer below your icon, invert the colors of your black and white icon, and change the layer property to multiply. Or, if you are feeling adventurous, you could try this CodeLab script: #region UICode byte Amount1 = 0; // [1] Delete|White|Black #endregion private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate(); void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = desaturateOp.Apply(src[x,y]); switch(Amount1) { case 0: // White chosen CurrentPixel.A = (byte)(255-CurrentPixel.R); CurrentPixel.R = 0; CurrentPixel.G = 0; CurrentPixel.B = 0; break; case 1: // Black chosen CurrentPixel.A = CurrentPixel.R; CurrentPixel.R = 255; CurrentPixel.G = 255; CurrentPixel.B = 255; break; } dst[x,y] = CurrentPixel; } } } Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Dialecticus Posted October 30, 2011 Author Share Posted October 30, 2011 I tried Grim Color Reaper plugin, and either I don't know how to use it or it does not do what I need. All I was able to manage was to remove black altogether. I tried to fiddle with layers already, but then I lose alpha channel. Background becomes green where I want it to remain invisible. I tried to save the script code above into .sls file and load it in script lab, but I get "Error loading script" message. Maybe I need to know more about scripts, so I'll investigate. In the mean time, is there some other plugin that can help me here? Quote Link to comment Share on other sites More sharing options...
Dialecticus Posted October 30, 2011 Author Share Posted October 30, 2011 No need to learn script lab tricks just yet. I found plugin Color Replacer (yeah, I know), which can be used in my case when option "Keep color distance" is checked. Quote Link to comment Share on other sites More sharing options...
SAND33P Posted October 30, 2011 Share Posted October 30, 2011 Surely the fill tool with some tolerance fiddling would have done the job? Albeit with some fudgy edges occasionally. Quote Link to comment Share on other sites More sharing options...
Dialecticus Posted October 31, 2011 Author Share Posted October 31, 2011 The fill tool fills everything with one color. So, instead of shades of green I would have only one green, and the rest that is not filled, and this is not what I want. Color Replacer gives me what I want. Quote Link to comment Share on other sites More sharing options...
pdnnoob Posted November 1, 2011 Share Posted November 1, 2011 1. Add a new layer underneath and fill it with the color you wish to replace the black with. 2. Run the Grim color reaper plugin on the top layer to remove the black. 3. Merge the layers. Quote No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.