Sign in to follow this  
Followers 0
ReMake

Eliminate Dark/Light

10 posts in this topic

This is very simple effect which allows to eliminate dark or light areas of the image. Good deletes black or white color (as a special case of dark or light, respectively).

 

The effect has a very simple interface. You can find it under Effects-> Color-> Eliminate Dark/Light.

 

EDL_UI.png

 

Below the sourse code for CodeLab.

 

 

// Author: ReMake
// Submenu: Color
// Name: Eliminate Dark/Light
// Title: Eliminate Dark/Light v1.0    ReMake 2015
// Desc: The Paint.Net effect eliminating dark or light areas of the image
// Keywords: paint.net|effect|eliminate|dark|light
// URL: http://www.getpaint.net/redirect/plugins.html
#region UICode
byte Amount1 = 0; // [1] Eliminate|Dark|Light
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CurrentPixel;
    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];
            int R = CurrentPixel.R;
            int G = CurrentPixel.G;
            int B = CurrentPixel.B;
            int A = CurrentPixel.A;
            
            if (A != 0)
		{
                  switch (Amount1)
                  {
                    case 0: // Dark
                        A = Math.Max(Math.Max(R, G), В);
                        break;
                
                    case 1: // Light
                        A = 255 - Math.Min(Math.Min(R, G), В);
                        break;
                  };
	}
            
            CurrentPixel.A = Int32Util.ClampToByte(A);            
            
            dst[x,y] = CurrentPixel;
        }
    }
}

 

 

This is аn icon for the effect:  icon.png

 

EliminateDarkLight.zip

 

P.S. I decided to start a new topic, because the former name of the topic Eliminate Black/Eliminate White was wrong.

7

Share this post


Link to post
Share on other sites

Thank you so much @Remake.  I loved your last one, so I know I will love this one too :D

1

Share this post


Link to post
Share on other sites

Thanks Mr ReMake!

 

Thank you so much @Remake.  I loved your last one, so I know I will love this one too :D

 

Thank you Remake, a useful plugin :)

 

Congrats on the new release, Remake! hi.gif

 

Thanks to all. I hope this effect will be useful to many users.

0

Share this post


Link to post
Share on other sites

ReMake!  

Thank you so much for the new version.  tpw7933m.gif  8ixedti9.gif

The picture from your own garden.

 

clrrqxe6.png

**** Original Photo

=======================

ff5432p5.png

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0