Jump to content
How to Install Plugins ×

Eliminate Dark/Light


ReMake

Recommended Posts

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.

 

Download from my PluginPack

 

eliminatedarklightuien.png

Original image:

Roses.jpg

 

Eliminate dark areas:

eliminatedarken.jpg

 

Eliminate light areas:

eliminatelighten.jpg

 

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

 

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

  • Upvote 6
Link to comment
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.

Link to comment
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

  • Upvote 1

Live as if you were to die tomorrow. Learn as if you were to live forever.

Gandhi

 

mae3426x.png

Link to comment
Share on other sites

Version 1.1 -  added a help file and both interfaces (en and ru) are merged into one plugin. Added new images.

Edited by ReMake
  • Like 2
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...