Jump to content

Temperature / Tint Adjustment


BoltBait

Recommended Posts

Due to a request here: http://forums.getpaint.net/index.php?/topic/111023-need-color-temperature-control-equivalent-to-windows-live-photo-gallery/

 

 

I created a Temperature / Tint Adjustment plugin.  It is found under the Adjustment menu.

 

User Interface:

 

TemperatureUI.png

 

Algorithm:

 

Here you can visualize the sliders overlaid on the standard color wheel:

 

TemperatureSliders.png

 

CodeLab Script:

// Name: Temperature/Tint
// Submenu: Adjustment
// Author: BoltBait
// Title: BoltBait's Temperature/Tint v1.3
// Version: 1.3
// Desc: Adjust the Temperature or Tint of a photograph
// Keywords: Temperature|Tint
// URL: http://BoltBait.com/pdn
#region UICode
IntSliderControl Amount1 = 0; // [-20,20] Temperature
IntSliderControl Amount2 = 0; // [-20,20] Tint
CheckboxControl Amount3 = false; // [0,1] Preview original image
#endregion

private byte Clamp2Byte(int iValue)
{
    if (iValue < 0) return 0;
    if (iValue > 255) return 255;
    return (byte)iValue;
}

unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
        ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra CurrentPixel = *srcPtr;

            if (!Amount3)
            {
                CurrentPixel.R = Clamp2Byte(CurrentPixel.R + Amount1); // Temperature
                CurrentPixel.B = Clamp2Byte(CurrentPixel.B - Amount1); // Temperature
                CurrentPixel.G = Clamp2Byte(CurrentPixel.G + Amount2); // Tint
            }

            *dstPtr = CurrentPixel;
            srcPtr++;
            dstPtr++;
        }
    }
}

 

Download:

 

Download as part of my plugin pack, here: http://forums.getpaint.net/index.php?/topic/32048-v

 

 

Support:

 

This plugin is for paint.net 4.0.6+

 

If you are running Paint.NET 3.5.11, you can build your own copy using the CodeLab source above.  You'll need to update the UICode region by replacing "IntSliderControl" with "int" and "CheckboxControl" with "bool".  Or, if CodeLab scares you, download the 3.5.11 version here: http://forums.getpaint.net/index.php?/topic/111031-temperature-tint-adjustment/&do=findComment&comment=527785

 

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to post
Share on other sites

This is a great Plugin @BoltBait and thank you :pizza:.  Perfect for getting a very subtle change in color on photos and will have many other uses as well.

 

uDdrfvn.png

Before

 

 

uwR2Fvp.png

After

 

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to post
Share on other sites
17 hours ago, BoltBait said:

If you are running Paint.NET 3.5.11, you can build your own copy using the CodeLab source above.  You'll need to update the UICode region by replacing "IntSliderControl" with "int" and "CheckboxControl" with "bool".

 

 

Thanks for the info BoltBait. I downloaded CodeLab v1.8 and made my own v3.5.11 compatible dll with my own icon. I did it in Linux under wine. It was touch and go for a while, but I managed to make a working version.

69unju0.gif

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...