Jump to content
How to Install Plugins ×

Green Tint Reduction v1.0 (Oct 2, 2017)


Recommended Posts

Green Tint Reduction

Effects -> Photo -> Green Tint Reduction

 

GreenTintReduction-UI.png

 

Description

Reduce green tint without introducing Magenta.

 

Technical Description

When reducing the Green channel to a reasonable amount, parts of a photo can became Magenta. :/

I wrote a script to check for Magenta's Hue range. That worked, but it had the side-effect of Reds becoming desaturated. Therefore, I also had it check the Saturation amount within that Hue range.

 

Instructions

Set the Tint Reduction, and then lower the Red Tolerance as needed.

Afterwards, further color adjustment could done with Curves, Levels, ect.

 

Examples

 

Spoiler

Before:

green1-before.jpg

After:

green1-after.jpg

 

Spoiler

 

green2-before.jpg  --->  green2-after.jpg

 

See how the Red is preserved without adding Magenta into the photo? 

 

Change Log

v1.0 (Oct 2, 2017)

  • Initial release

 

Download

 

 GreenTintReduction.zip

 

 

Source Code

Spoiler

GreenTintReduction.png   <--- Icon


// Name: Green Tint Reduction
// Submenu: Photo
// Author: toe_head2001
// Title:
// Version: 1.0
// Desc: Reduce green tint without introducing Magenta.
// Keywords: photo|tint|green
// URL:
// Help:
#region UICode
IntSliderControl Amount1 = 80; // [0,128] Tint Reduction
IntSliderControl Amount2 = 50; // [0,100] Red Tolerance
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CurrentPixel;
    HsvColor hsvEval;
    byte originalGreen;
    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];
            originalGreen = CurrentPixel.G;

            CurrentPixel.G = Int32Util.ClampToByte(originalGreen - Amount1);
            hsvEval = HsvColor.FromColor(CurrentPixel);
            while ((hsvEval.Hue > 250 || hsvEval.Hue < 30) && hsvEval.Saturation < Amount2)
            {
                if (CurrentPixel.G == originalGreen)
                    break;
                    
                CurrentPixel.G++;
                hsvEval = HsvColor.FromColor(CurrentPixel);
            }

            dst[x,y] = CurrentPixel;
        }
    }
}

 

 

Icon based on an icon from Fugue.

Edited by toe_head2001
  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

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...