Popular Post ReMake Posted March 21, 2016 Popular Post Share Posted March 21, 2016 This plugin can be useful for selecting objects in the image or for creation a color mask of object. The plugin is based on the script of Color Target plugin by @rwp80. You can find it: Effects -> Color -> Color Range Download from my PluginPack This effect allows you to create a color mask of object in the image. You can then select the object using Magic Wand ( ) for further work with him. See short tutorial and examples of effect's work in the Color Range Test topic. CodeLab script: Spoiler // Name: Color Range // Submenu: Color // Author: ReMake // Title: Color Range v1.0 ReMake 2016 // Version: 1.0 // Desc: // Keywords: paint.net|effect|color|range|color range // URL: http://www.getpaint.net/redirect/plugins.html #region UICode byte Amount1 = 0; // Color|Custom|Red|Yellow|Green|Cyan|Blue|Magenta|White|Grey|Black ColorBgra Amount2 = ColorBgra.FromBgr(0, 0, 0); // int Amount3 = 225; // [0,255] Color Threshold int Amount4 = 255; // [0,255] Brightness Tolerance #endregion void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; int R, G, B, A, CR, CG, CB, GtR, GtB, CGtR, CGtB; int ColThr = Amount3; int BriTol = Amount4; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x, y]; CR = CG = CB = 0; B = CurrentPixel.B; G = CurrentPixel.G; R = CurrentPixel.R; A = CurrentPixel.A; switch (Amount1) { case 0: // Custom CB = Amount2.B; CG = Amount2.G; CR = Amount2.R; break; case 1: // Red CR = 255; break; case 2: // Yellow CR = CG = 255; break; case 3: // Green CG = 128; break; case 4: // Cyan CG = CB = 255; break; case 5: // Blue CB = 255; break; case 6: // Magenta CR = CB = 255; break; case 7: // White CR = CG = CB = 255; break; case 8: // Grey CR = CG = CB = 128; break; case 9: // Black CR = CG = CB = 0; break; } GtR = R - G; GtB = B - G; CGtR = CR - CG; CGtB = CB - CG; if ((GtR <= CGtR - ColThr) || (GtR >= CGtR + ColThr) || (GtB <= CGtB - ColThr) || (GtB >= CGtB + ColThr) || (B <= CB - BriTol) || (B >= CB + BriTol) || (G <= CG - BriTol) || (G >= CG + BriTol) || (R <= CR - BriTol) || (R >= CR + BriTol)) { A = 0; } CurrentPixel = ColorBgra.FromBgra( Int32Util.ClampToByte((int)CB), Int32Util.ClampToByte((int)CG), Int32Util.ClampToByte((int)CR), Int32Util.ClampToByte((int)A)); dst[x, y] = CurrentPixel; } } } and icon: Examples of effect's technique you can found in How To Use Color Range effect topic. Примеры работы эффекта и приемы работы с ним вы можете посмотреть в уроке Как использовать эффект 'Цветовой диапазон'. 1 9 Quote Link to comment Share on other sites More sharing options...
Hypure Posted March 21, 2016 Share Posted March 21, 2016 I have a feeling this is going to come in very handy... 1 Quote Link to comment Share on other sites More sharing options...
AgentGoodspeed Posted March 21, 2016 Share Posted March 21, 2016 Good job!I don't know if it's a bug or I'm using it wrong but it even though I used the color picker, the color doesn't appear in the plug-in, it defaults to white. 1 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted March 22, 2016 Share Posted March 22, 2016 I looked at the source code, and I am wondering: why are you using the double type for the color channels? Surely the int type would be sufficient, as there aren't any operations in the script that would produce numbers with decimal places. 1 Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Maximilian Posted March 22, 2016 Share Posted March 22, 2016 Hmm, I'm experiencing the same situation described above by AgentGoodSpeed. 1 Quote Link to comment Share on other sites More sharing options...
ReMake Posted March 22, 2016 Author Share Posted March 22, 2016 ... but it even though I used the color picker, the color doesn't appear in the plug-in, it defaults to white. Hmm, I'm experiencing the same situation described above by AgentGoodSpeed. Fixed. Primary color now color by default. I looked at the source code, and I am wondering: why are you using the double type for the color channels? Surely the int type would be sufficient, as there aren't any operations in the script that would produce numbers with decimal places. I'll work on it today. Thanks for the tip. 1 2 Quote Link to comment Share on other sites More sharing options...
Maximilian Posted March 22, 2016 Share Posted March 22, 2016 Thanks for the quick fix! 1 1 Quote Link to comment Share on other sites More sharing options...
Nai Posted March 22, 2016 Share Posted March 22, 2016 Congratulations, ReMake ! I like this plugin. It helps me in extracting images and so many purposes. 1 Quote Link to comment Share on other sites More sharing options...
ReMake Posted March 22, 2016 Author Share Posted March 22, 2016 An unfortunate spelling error. My apologies to anyone who downloaded the English version of the effect. Re-download the fixed version, please. Thank to all for your comments, remarks and tips. 2 Quote Link to comment Share on other sites More sharing options...
AgentGoodspeed Posted March 22, 2016 Share Posted March 22, 2016 Works now, thanks Quote Link to comment Share on other sites More sharing options...
lynxster4 Posted March 22, 2016 Share Posted March 22, 2016 (edited) ReMake, this plugin is WONDERFUL! It's easy to use and with very little tweaking, it achieves a near flawless recoloring. It just looks so smooth.....no splotches! Thank you, ReMake! Edited July 27, 2017 by lynxster4 re-hosted image 2 Quote My Art Gallery | My Shape Packs | ShapeMaker Mini Tut | Air Bubble Stained Glass Chrome Text with Reflections | Porcelain Text w/ Variegated Coloring | Realistic Knit PatternOpalescent Stained Glass | Frosted Snowman Cookie | Leather Texture | Plastic Text | Silk Embroidery Visit my Personal Website "Never, ever lose your sense of humor - you'll live longer" Link to comment Share on other sites More sharing options...
ReMake Posted March 27, 2016 Author Share Posted March 27, 2016 Fixed color selection error in the English version. Update this plugin from first post, please. 1 2 Quote Link to comment Share on other sites More sharing options...
MartinOK Posted July 7, 2019 Share Posted July 7, 2019 Why isnt there any "Skin tones" in this funtion? Like if you wanna remove the skintone from a tattoo.. Like you can do in photoshop Quote Link to comment Share on other sites More sharing options...
ReMake Posted July 8, 2019 Author Share Posted July 8, 2019 Use the Color Picker () Tool to define the skin tone as the Primary (left click) or Secondary (right click) color. When the effect is applied, your color will be saved or removed accordingly. 1 Quote Link to comment Share on other sites More sharing options...
Seerose Posted July 9, 2019 Share Posted July 9, 2019 @ReMake! Thank you very much for your effort. 1 Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
ReMake Posted July 12, 2019 Author Share Posted July 12, 2019 Version 1.1 released. Added 'Show Original Image' checkbox. Added Help file. User Interface and Help file are available in English and Russian. 1 Quote Link to comment Share on other sites More sharing options...
Seerose Posted July 14, 2019 Share Posted July 14, 2019 @ReMake! Thank you so much for the new version and your effort. 1 Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi 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.