ReMake Posted December 17, 2020 Posted December 17, 2020 This effect is similar to the Photoshop's Dynamic Contrast filter and allows you to create images with high contrast. You can find this effect in Adjustments menu. Download from my PluginPack Amount - the range of adjustment of contrast.Threshold - sets the threshold for enabling a color (and its shades) or a mixture of colors in the Blue -> Red -> Green direction.Intensity - sets the pixel intensity of the image. When Amount = 0, the Threshold and Intensity controls have no effect on the image and are therefore disabled. Examples of the plugin work: Before: After: CodeLab source code: Spoiler // Name:Dynamic Contrast // Submenu: // Author:ReMake // Title:Dynamic Contrast // Version:1.1 // Desc:The effect of adjusting the contrast of the image // Keywords:paint.net|effect|dynamic|contrast // URL:https://www.getpaint.net/redirect/plugins.html #region UICode int amount = 0; // [-64,64] Amount int threshold = 128; // [0,255] {!amount} Threshold int intensity = 255; // [0,255] {!amount} Intensity #endregion public int Mix (int c, int luma) { return (int)(c - (float)Math.Sqrt(Math.Abs(threshold - luma))*((luma > threshold) ? -amount : amount)) * intensity / 255 + c * (255 - intensity) / 255; } void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; int R, G, B, luma; 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]; R = CurrentPixel.R; G = CurrentPixel.G; B = CurrentPixel.B; luma = (76 * R + 150 * G + 29 * B) / 256; R = Mix(R, luma); G = Mix(G, luma); B = Mix(B, luma); CurrentPixel = ColorBgra.FromBgraClamped(B, G, R, CurrentPixel.A); dst[x,y] = CurrentPixel; } } } private void OnWindowHelpButtonClicked(IWin32Window owner, string helpContent) { MessageBox.Show(owner, "Dynamic Contrast v1.1\n\nThe effect of adjusting the contrast of the image.\n\nCopyright ©2020 by ReMake\nAll rights reserved.", "Dynamic Contrast", MessageBoxButtons.OK, MessageBoxIcon.Information); } To have a clearer understanding of how this effect works, upload the image below. Run the effect. Set the Amount and Threshold controls to the leftmost position. Slowly move the Threshold control to the rightmost position and watch the colors contrast change. Set the Amount control to the rightmost position and move the Threshold control again from left to right, watching the colors change. View how the effect works with different settings on all three sliders. Here are some examples: I hope you will like this effect and find a use for it. 2 4 Quote
lynxster4 Posted December 17, 2020 Posted December 17, 2020 (edited) Thank you @ReMake! I will try this. 🙂 EDIT: Just tried it...it works great! 👍 Edited December 17, 2020 by lynxster4 1 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"
Vagabondi Posted December 17, 2020 Posted December 17, 2020 Works both ways. Thank you @ReMake! 1 Quote my gallery is here
ReMake Posted December 18, 2020 Author Posted December 18, 2020 The effect has been updated to version 1.1. With some settings in the previous version, the image looked posterized. @Reptillian kindly gave me a suggestion on how to improve the effect. Now the image looks smoother. Thanks to @Reptillian for his assistance. Download the new version of the effect from the first post. 2 1 Quote
Panchdara Posted December 19, 2020 Posted December 19, 2020 21 hours ago, ReMake said: The effect has been updated to version 1.1. Download the new version of the effect from the first post. Thank you. Have you updated the source? Best wishes Quote
ReMake Posted December 19, 2020 Author Posted December 19, 2020 1 hour ago, Panchdara said: Have you updated the source? Yes, of course. Quote
Panchdara Posted December 20, 2020 Posted December 20, 2020 21 hours ago, ReMake said: Yes, of course. Thanks. Whilst I'm no longer an active programmer I do like to see (sorta) what is being done. I see in the source above still states version 1.0 so that's why I asked. Best Quote
ReMake Posted December 20, 2020 Author Posted December 20, 2020 2 hours ago, Panchdara said: I see in the source above still states version 1.0 so that's why I asked. Fixed. Quote
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.