pavlik1307 Posted May 4, 2018 Share Posted May 4, 2018 (edited) Description: This plugin allows you to reduce the number of colors in an image with the help of eleven error diffusion dithering algorithms. You are able to choose one of the four software palettes or to use automatically generated palette with specified size. You can also enable "Serpentine scanning" to alternate scanning direction between lines. Unfortunately, these algorithms do not work quickly due to single-threadedness. The advantage of this plugin is that it correctly works with any selection. Plugin: Effects > Stylize > Error diffusion dithering Examples: Github: https://github.com/PavielKraskouski/PaintDotNetPlugins/tree/master/ErrorDiffusionDithering Download: ErrorDiffusionDithering.dll Edited November 28, 2022 by pavlik1307 5 1 Quote Link to comment Share on other sites More sharing options...
Seerose Posted May 4, 2018 Share Posted May 4, 2018 @pavlik1307! Thank you for your effort. 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...
BoltBait Posted May 4, 2018 Share Posted May 4, 2018 I prefer this one: https://forums.getpaint.net/topic/29428-floyd-steinberg-dithering-including-source/ 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...
toe_head2001 Posted May 4, 2018 Share Posted May 4, 2018 Why would someone want to apply dithering to their images these days? ^ This is not a rhetorical question. 9 hours ago, pavlik1307 said: Plugin: Effects > Advanced > Error diffusion dithering I recommend placing this effect into the Stylize menu. Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
pavlik1307 Posted May 4, 2018 Author Share Posted May 4, 2018 @toe_head2001, moved plugin to Stylize menu, as you recommended. As for your question, I thought that this plugin could be useful and interesting for someone. Quote Link to comment Share on other sites More sharing options...
NinthDesertDude Posted May 5, 2018 Share Posted May 5, 2018 If the dithering algorithm locks bits and iterates through pixels with two for loops, replace the inner for loop with Parallel.For (look it up, it's easy to use) and you'll get some parallelization without much effort. Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted May 5, 2018 Author Share Posted May 5, 2018 @Joshua Lamusga, I can't parallelize dithering algorithm, because processing of following pixels depends on processing of previous pixels. But after your message, I realized that I could make neighbouring pixels be processed in parallel. I tried to use Parallel class with Partitioner class (to make processing more chunky). It works, but much longer than without parallelism. And I don't know why (I have experience using Parallel class, so it can't be my misunderstanding of its work). Quote Link to comment Share on other sites More sharing options...
Eli Posted May 5, 2018 Share Posted May 5, 2018 Thanks for this effect @pavlik1307 . I found in GitHub some interesting dithering results. There is one that I like the "Sierra Lite" . Do you think that it could be added to your effect? Spoiler Sierra Lite dithering Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted May 5, 2018 Author Share Posted May 5, 2018 (edited) @Eli, my plugin implements eleven dithering algorithm. "Sierra Lite" and two other Sierra algorithms are already included. See the list of available algorithms below: Edited April 20, 2019 by pavlik1307 Quote Link to comment Share on other sites More sharing options...
Eli Posted May 5, 2018 Share Posted May 5, 2018 @pavlik1307 Sorry I did not see it. I have tried but I can not get the same result as un Github. Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted May 5, 2018 Author Share Posted May 5, 2018 @Eli, I added "Black and white 2-color palette" to the plugin, because it is used on your sample image. Also, before applying dithering, I changed image contrast to 70. I achieved almost the same result as on Github, but it is slightly different. I think that github author made some preprocessing and other actions in his algorithms. Quote Link to comment Share on other sites More sharing options...
Eli Posted May 5, 2018 Share Posted May 5, 2018 Thanks for the "Black and white 2-color palette" addition. The result is very close. I think that you should integrate in the effect contrast and brightnes sliders that way you should have better control over the results. If you find out what other actions were applied in the Github example and add them to the effect would be nice too. The "wavy dithering" is very interesting. It looks like the ones used on the presidents' portraits on the dollar bills. Spoiler Quote Link to comment Share on other sites More sharing options...
Reptillian Posted May 12, 2018 Share Posted May 12, 2018 (edited) On 5/4/2018 at 5:32 PM, toe_head2001 said: Why would someone want to apply dithering to their images these days? ^ This is not a rhetorical question. Artistic effect or compatibility with very old games/softwares. Some older games have limited palette, and to reduce banding, dithering is used. If you are modding say Ultimate Ride Disney Coaster, you'd note that dithering is the only way to reduce banding in menu images. Some games are reduced to 256 colors, and dithering helps the issue of banding. For artistic effect, amiga images achieves have some very nice images of how low color and dithering can give a oil feel that is somewhat rough. But, I do agree that for modern softwares purpose, for all intents and purposes, dithering isn't very useful, and there's no point to it unless you have a taste for it or you specialize in pixel art. Indexing still have use in separating colors for generating effects though. Threshold filter has some very useful niche usage for example. Edited May 12, 2018 by Reptillian Quote G'MIC Filter Developer Link to comment Share on other sites More sharing options...
pavlik1307 Posted April 18, 2019 Author Share Posted April 18, 2019 Updated plugin. Improved color distance calculation, added new option "Automatic palette" to "Target palette", added slider to specify the size of the automatic palette. 2 1 Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted October 3, 2019 Author Share Posted October 3, 2019 I have updated the plugin. Improved color quantization algorithm (automatic palette). 2 Quote Link to comment Share on other sites More sharing options...
ChrisJS Posted May 1, 2020 Share Posted May 1, 2020 Just checking in to let you know that this plugin is fantastic. The previous one in paint.net was getting frustrating because it would show horizontal banding artifacts. (I don't know if it was the included or one I added to Effects.) This one does not show those problems at all! As to the modern uses - although not my day job (or paid job :-( ) I sometimes have to prep items for commercial printing. This plugin is ideal for reducing grey scale images to dithered black and white, which give much more predictable results at the print shop. On a similar note, it is ideal for building index separations from full colour images before sending them as shirt silk screen masters. For that last use, the one feature that could make this even more useful is a way to specify a custom palette - which could be made to match up to a selection of available silk screen inks. Currently you have a selection of palettes, but no custom option. There is already an accepted paint.net palette format, so just allowing one of those as an input would be a nice feature! Quote Link to comment Share on other sites More sharing options...
BoltBait Posted May 1, 2020 Share Posted May 1, 2020 27 minutes ago, ChrisJS said: The previous one in paint.net was getting frustrating because it would show horizontal banding artifacts. You're talking about the one in my plugin pack. Just to let you know, I fixed that problem a long time ago. Update to my latest pack and see if you like it better. 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...
ChrisJS Posted May 1, 2020 Share Posted May 1, 2020 1 minute ago, BoltBait said: You're talking about the one in my plugin pack. Just to let you know, I fixed that problem a long time ago. Update to my latest pack and see if you like it better. Yeah - I'm not great about keeping those up to date. My phone has me spoiled. Has anyone created a Paint.net plugin subscription service?? 🙂 Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted May 1, 2020 Author Share Posted May 1, 2020 @ChrisJS, thanks for your feedback! Yes, it would be great to be able to choose a custom palette. But first, I need to learn how to work with paint.net palettes because, I never came across this. I also plan to add another color quantization algorithm. Currently, automatic colors are generated by dividing image RGB space into equal volumes. The new algorithm will use octree for color quantization. 1 Quote Link to comment Share on other sites More sharing options...
Vasyna Posted October 24, 2020 Share Posted October 24, 2020 On 5/1/2020 at 10:50 PM, pavlik1307 said: @ChrisJS, thanks for your feedback! Yes, it would be great to be able to choose a custom palette. But first, I need to learn how to work with paint.net palettes because, I never came across this. I also plan to add another color quantization algorithm. Currently, automatic colors are generated by dividing image RGB space into equal volumes. The new algorithm will use octree for color quantization. Hi Pavlik, thanks for your plug-in. It was very useful for comparing various algorithms for converting different types of images to monochrome bitmaps. Any chance you'd release a new version soon as you mentioned? I think it would also be good to see other methods: - Gradient-based error-diffusion dithering mentioned in https://en.wikipedia.org/wiki/Dither - A Simple and Efficient Error-Diffusion Algorithm (https://perso.liris.cnrs.fr/victor.ostromoukhov/publications/pdf/SIGGRAPH01_varcoeffED.pdf ) - Structure-Aware Error Diffusion (https://perso.liris.cnrs.fr/victor.ostromoukhov/publications/pdf/SIGGRAPH-ASIA09_saed.pdf) Quote Link to comment Share on other sites More sharing options...
pavlik1307 Posted November 5, 2020 Author Share Posted November 5, 2020 Hi @Vasyna. At the moment I can't tell when I will update the plugin as I have other things to do. It's also interesting to add other dithering methods, color quantization algorithms and color palettes. But I don't know when. 1 Quote Link to comment Share on other sites More sharing options...
randomnessYTOG Posted January 12 Share Posted January 12 as soon as i try to apply or edit automatic pallet in error diffusion, it crashes. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted January 12 Share Posted January 12 Please give us a screenshot of the crash or the contents of the CrashLog. 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...
randomnessYTOG Posted January 12 Share Posted January 12 this is the error details: File: C:\Program Files\paint.net\Effects\ErrorDiffusion - Copy.dll Effect Name: ErrorDiffusionDithering.ErrorDiffusionDitheringEffect Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at ErrorDiffusionDithering.Palette.FromSurface(Surface surface, Int32 paletteSize) at ErrorDiffusionDithering.ErrorDiffusionDitheringEffect.Render(Surface dst, Surface src, PdnRegion selection, Rectangle rect) at ErrorDiffusionDithering.ErrorDiffusionDitheringEffect.OnRender(Rectangle[] renderRects, Int32 startIndex, Int32 length) at PaintDotNet.Effects.Effect`1.Render(EffectConfigToken token, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length) in D:\src\pdn\src\Effects.Core\Effects\Effect`1.cs:line 103 at PaintDotNet.Effects.Effect.ClassicEffectRenderer.Render(ReadOnlySpan`1 renderRects) in D:\src\pdn\src\Effects.Core\Effects\Effect.cs:line 578 at PaintDotNet.Effects.ClassicEffectDriver.OnRendererRender(IClassicEffectRenderer renderer, ILockedBitmap`1 dstBitmap, ReadOnlySpan`1 renderRects) in D:\src\pdn\src\PaintDotNet\Effects\ClassicEffectDriver.cs:line 95 at PaintDotNet.Effects.EffectDriver`1.RenderWithClipMask(PooledNativeList`1 rois, Result`1 lazyClipMaskRenderer) in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 346 at PaintDotNet.Effects.EffectDriver`1.RendererContext.RenderTile(Int32 tileIndex) in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 254 at PaintDotNet.Effects.EffectDriver`1.RendererContext.RenderNextTile() in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 249 at PaintDotNet.Effects.EffectDriver`1.<>c__DisplayClass51_0.<ThreadFunction>b__0() in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 384 --- End of inner exception stack trace --- at PaintDotNet.Effects.EffectDriver`1.DrainExceptions() in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 528 at PaintDotNet.Effects.EffectDriver`1.Join() in D:\src\pdn\src\PaintDotNet\Effects\EffectDriver`1.cs:line 519 at PaintDotNet.Menus.EffectMenuBase.DoEffect(IEffect effect, EffectConfigToken token, Result`1 lazyAllRenderScans, Result`1 lazyRemainingRenderScans, Surface originalSurface, Exception& exception) in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 1601 Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted January 13 Share Posted January 13 I'm not sure if this is the problem, but the DLL is misnamed: ErrorDiffusion - Copy.dll It should be called ErrorDiffusionDithering.dll. Try renaming it and restarting PDN. 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...
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.