pauliux00 Posted January 1, 2014 Share Posted January 1, 2014 (edited) A Plugin that converts pixels in an image to 8 bit color. A handy plugin, that could convert the colors in an image to 8-Bit. Example: It could be a useful tool for the old-school painters. 8 bits of color: Paint.NET Palette of 8-Bit colors Edited January 1, 2014 by pauliux00 Quote Link to comment Share on other sites More sharing options...
TechnoRobbo Posted January 1, 2014 Share Posted January 1, 2014 Your palette has has 257 colors. That being said a color quantitization routine can force-fit any size palette. Let me clean my snow and I'll post a custom plugin. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted January 1, 2014 Share Posted January 1, 2014 Save it as a GIF. GIFs have an 8-bit palette Once saved you can reopen the image and use Save As to change the file format. Alternatively there is this plugin which allows you to specify the color depth Low Color Filetype. 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
midora Posted January 1, 2014 Share Posted January 1, 2014 >> A handy plugin, that could convert the colors in an image to 8-Bit. Just a remark: A plugin ist just able to quantize the colors to a given or an optimal set of colors. The bitmap will still be 32bit. There is no guaranty that saving this bitmap to an 8bit format will keep the colors generated by the plugin. Typically the 8bit filetype plugins do their own quantization. A good quantizer is a complex thing because it has to respect the sensitivity of the human eye. (It's a little bit more than just counting and mapping colors). Quote Link to comment Share on other sites More sharing options...
TechnoRobbo Posted January 1, 2014 Share Posted January 1, 2014 (edited) Listen to EER and Midora , this plugin will force-fit any image to an arbitrary palette but it will not reduce the bit count. It can be found under the colors menu The Plugin 3.5 compatible TRsPaletteMatcher.zip The CodeLab Source The proof of concept image, it's your image - note how the left hand side now matches the right. Source Code Hidden Content: // Submenu: Color // Name: TR's Palette Matcher // Title: TR's Palette Matcher- v1.0 // Author: TechnoRobbo // URL: http://www.technorobbo.com #region UICode #endregion void Render(Surface dst, Surface src, Rectangle rect) { uint[] colorarray={ 0xFF000000,0xFFFFFFFF,0xFF000055,0xFF0000AA,0xFF0000FF,0xFF002400,0xFF002455,0xFF0024AA, 0xFF0024FF,0xFF004800,0xFF004855,0xFF0048AA,0xFF0048FF,0xFF006C00,0xFF006C55,0xFF006CAA, 0xFF006CFF,0xFF009000,0xFF009055,0xFF0090AA,0xFF0090FF,0xFF00B400,0xFF00B455,0xFF00B4AA, 0xFF00B4FF,0xFF00D800,0xFF00D855,0xFF00D8AA,0xFF00D8FF,0xFF00FC00,0xFF00FC55,0xFF00FCAA, 0xFF00FCFF,0xFF240000,0xFF240055,0xFF2400AA,0xFF2400FF,0xFF242400,0xFF242455,0xFF2424AA, 0xFF2424FF,0xFF244800,0xFF244855,0xFF2448AA,0xFF2448FF,0xFF246C00,0xFF246C55,0xFF246CAA, 0xFF246CFF,0xFF249000,0xFF249055,0xFF2490AA,0xFF2490FF,0xFF24B400,0xFF24B455,0xFF24B4AA, 0xFF24B4FF,0xFF24D800,0xFF24D855,0xFF24D8AA,0xFF24D8FF,0xFF24FC00,0xFF24FC55,0xFF24FCAA, 0xFF24FCFF,0xFF480000,0xFF480055,0xFF4800AA,0xFF4800FF,0xFF482400,0xFF482455,0xFF4824AA, 0xFF4824FF,0xFF484800,0xFF484855,0xFF4848AA,0xFF4848FF,0xFF486C00,0xFF486C55,0xFF486CAA, 0xFF486CFF,0xFF489000,0xFF489055,0xFF4890AA,0xFF4890FF,0xFF48B400,0xFF48B455,0xFF48B4AA, 0xFF48B4FF,0xFF48D800,0xFF48D855,0xFF48D8AA,0xFF48D8FF,0xFF48FC00,0xFF48FC55,0xFF48FCAA, 0xFF48FCFF,0xFF6C0000,0xFF6C0055,0xFF6C00AA,0xFF6C00FF,0xFF6C2400,0xFF6C2455,0xFF6C24AA, 0xFF6C24FF,0xFF6C4800,0xFF6C4855,0xFF6C48AA,0xFF6C48FF,0xFF6C6C00,0xFF6C6C55,0xFF6C6CAA, 0xFF6C6CFF,0xFF6C9000,0xFF6C9055,0xFF6C90AA,0xFF6C90FF,0xFF6CB400,0xFF6CB455,0xFF6CB4AA, 0xFF6CB4FF,0xFF6CD800,0xFF6CD855,0xFF6CD8AA,0xFF6CD8FF,0xFF6CFC00,0xFF6CFC55,0xFF6CFCAA, 0xFF6CFCFF,0xFF900000,0xFF900055,0xFF9000AA,0xFF9000FF,0xFF902400,0xFF902455,0xFF9024AA, 0xFF9024FF,0xFF904800,0xFF904855,0xFF9048AA,0xFF9048FF,0xFF906C00,0xFF906C55,0xFF906CAA, 0xFF906CFF,0xFF909000,0xFF909055,0xFF9090AA,0xFF9090FF,0xFF90B400,0xFF90B455,0xFF90B4AA, 0xFF90B4FF,0xFF90D800,0xFF90D855,0xFF90D8AA,0xFF90D8FF,0xFF90FC00,0xFF90FC55,0xFF90FCAA, 0xFF90FCFF,0xFFB40000,0xFFB40055,0xFFB400AA,0xFFB400FF,0xFFB42400,0xFFB42455,0xFFB424AA, 0xFFB424FF,0xFFB44800,0xFFB44855,0xFFB448AA,0xFFB448FF,0xFFB46C00,0xFFB46C55,0xFFB46CAA, 0xFFB46CFF,0xFFB49000,0xFFB49055,0xFFB490AA,0xFFB490FF,0xFFB4B400,0xFFB4B455,0xFFB4B4AA, 0xFFB4B4FF,0xFFB4D800,0xFFB4D855,0xFFB4D8AA,0xFFB4D8FF,0xFFB4FC00,0xFFB4FC55,0xFFB4FCAA, 0xFFB4FCFF,0xFFD80000,0xFFD80055,0xFFD800AA,0xFFD800FF,0xFFD82400,0xFFD82455,0xFFD824AA, 0xFFD824FF,0xFFD84800,0xFFD84855,0xFFD848AA,0xFFD848FF,0xFFD86C00,0xFFD86C55,0xFFD86CAA, 0xFFD86CFF,0xFFD89000,0xFFD89055,0xFFD890AA,0xFFD890FF,0xFFD8B400,0xFFD8B455,0xFFD8B4AA, 0xFFD8B4FF,0xFFD8D800,0xFFD8D855,0xFFD8D8AA,0xFFD8D8FF,0xFFD8FC00,0xFFD8FC55,0xFFD8FCAA, 0xFFD8FCFF,0xFFFC0000,0xFFFC0055,0xFFFC00AA,0xFFFC00FF,0xFFFC2400,0xFFFC2455,0xFFFC24AA, 0xFFFC24FF,0xFFFC4800,0xFFFC4855,0xFFFC48AA,0xFFFC48FF,0xFFFC6C00,0xFFFC6C55,0xFFFC6CAA, 0xFFFC6CFF,0xFFFC9000,0xFFFC9055,0xFFFC90AA,0xFFFC90FF,0xFFFCB400,0xFFFCB455,0xFFFCB4AA, 0xFFFCB4FF,0xFFFCD800,0xFFFCD855,0xFFFCD8AA,0xFFFCD8FF,0xFFFCFC00,0xFFFCFC55,0xFFFCFCAA, 0xFFFCFCFF }; ColorBgra[] Colorz=new ColorBgra[colorarray.Length]; for (int i =0;i < Colorz.Length; i++) { Colorz[i] = ColorBgra.FromUInt32(colorarray[i]); } for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CP= src[x,y]; double closer = 0; int match = 0; double val = Math.Sqrt( (CP.G- Colorz[0].G) * (CP.G- Colorz[0].G) + (CP.B- Colorz[0]. * (CP.B- Colorz[0]. + (CP.R - Colorz[0].R) * (CP.R - Colorz[0].R)); for (int i = 0; i < Colorz.Length ;i++) { double val2 = Math.Sqrt( (CP.G- Colorz[i].G) * (CP.G- Colorz[i].G) + (CP.B- Colorz[i]. * (CP.B- Colorz[i]. + (CP.R - Colorz[i].R) * (CP.R - Colorz[i].R)); if (val2 < val) { val=val2; match=i; } } dst[x,y] = Colorz[match]; } } } I find it amazing how the Pythagorean theorem solves so many problems. I will not publish this as topic because I haven't figured out how to read the current palette. Sure I can load a saved palette but that's not interactive enough. Edited August 11, 2015 by TechnoRobbo Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
BoltBait Posted January 1, 2014 Share Posted January 1, 2014 I haven't figured out how to read the current palette. The currently loaded palette can be found in the registry here: Computer\HKEY_CURRENT_USER\Software\Paint.NET\Workspace/CurrentPalette 1 Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
TechnoRobbo Posted January 2, 2014 Share Posted January 2, 2014 (edited) The currently loaded palette can be found in the registry here:Computer\HKEY_CURRENT_USER\Software\Paint.NET\Workspace/CurrentPalette Excellent, Thanks BoltBait , any guarantee of being future proof? Edited January 2, 2014 by TechnoRobbo Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
TechnoRobbo Posted January 2, 2014 Share Posted January 2, 2014 BoltBait Thanks for the information but the WorkSpace/CurrentPalette is not 3.5 compatible but it works great with 4.0. I will redirect my efforts into saved Custom palettes. Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
Rick Brewster Posted January 2, 2014 Share Posted January 2, 2014 It's a very bad idea to load things from Paint.NET's private registry store like that. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
TechnoRobbo Posted January 2, 2014 Share Posted January 2, 2014 (edited) It's a very bad idea to load things from Paint.NET's private registry store like that. Agreed - I rewrote to load from saved custom palettes http://forums.getpaint.net/index.php?/topic/27677-trs-custom-palette-matcher-v10/?p=402433 Edited January 2, 2014 by TechnoRobbo 1 Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins 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.