Jump to content

Need "Color Temperature" control equivalent to Windows Live Photo Gallery


Tango

Recommended Posts

Background: I have been using Windows Live Photo Gallery (WLPG) for most of my simple photo editing as it has everything I need for global editing (no layers, no selecting portions of an image for editing). Have recently started using Paint.net (PN) for more complicated tasks.

 

Problem: Have been able to find the equivalent of most of WLPG features in PN, with the notable exception of Color Temperature adjustment. Sure, I could play around with Level, Curves, Hue/Saturation and finally get what I want (and then some), but very often, a single-slider Color Temperature control is all I need to add back some warmth in skin tones in a photo taken with a flash, for example, or remove some in a photo taken with indoor (tungsten) light.

 

Questions:

(1) What is the simplest way to achieve that with built-in PN features?

(2) Is there a recommended Plugin that will make it even simpler?

 

Thanks!

Link to comment
Share on other sites

Here is a CodeLab script to do what you want:

 

// Name: Temperature/Tint
// Submenu: Photo
// Author: BoltBait
// Title: BoltBait's Temperature/Tint v1.1
// Version: 1.1
// Desc: Adjust the Temperature or Tint of a photograph
// Keywords: Temperature|Tint
// URL: http://BoltBait.com/pdn
#region UICode
IntSliderControl Amount1 = 0; // [-100,100] Temperature
IntSliderControl Amount2 = 0; // [-100,100] 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;
}


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];
            if (!Amount3)
            {
                CurrentPixel.G = Clamp2Byte(CurrentPixel.G + Amount2); // Tint
                CurrentPixel.R = Clamp2Byte(CurrentPixel.R + Amount1); // Temperature
                CurrentPixel.B = Clamp2Byte(CurrentPixel.B - Amount1); // Temperature
            }
            dst[x,y] = CurrentPixel;
        }
    }
}

 

  • Upvote 2
Link to comment
Share on other sites

Thanks BoltBait, but the effect isn't what the Color Temperature control in WLPG does (and it doesn't have the desired effect in actual use either). You're increasing red and decreasing blue for "warmer," and the reverse for "cooler," but what WLPG does is not quite as simple. E.g., it is asymmetric (warmer and cooler are not the inverse of each other) and non-linear (intensity of adjustment of R/G/B are not linear with level of warming/cooler applied). There is even some (but very small) cross-correlation between what the level of one channel is to the effect of adjustment on the other channel (but it's so small that probably this can be ignored).

 

I did some tests with 25%, 50% and 75% grey to come up with the above conclusions once I saw that BoltBait's script wasn't doing the same thing (and one with 75% R, 50% G, 25% B to check the cross-correlation) and here is the result (converted to image). I suppose one could come up with more intermediate points and come up with a heuristic curve that emulates the WLPG filter. Probably could improve upon it too since I sometimes need more than the max amount provided by WLPG and the additional range could be incorporated.

 

I got curious and searched for a research paper on what such an equation might actually be (R, G and B levels as a function of desired color temperature adjustment). It must surely exist but I couldn't come up with it, at least not with a casual Google search.

wlpg-color-temp-chart.jpg

Link to comment
Share on other sites

My mistake!

 

There was a bug in the compiled code but not in the script shown above.

 

Here is a corrected dll (version 1.1):

 

 

<snip>

 

Hope this helps!

 

BTW, it is way more sensitive than your table above. So, instead of Gray 127 adjusting to 100, adjust to 19 or 20 instead.  The numbers will still not come out perfect to your table, but should be close enough on a photograph that you shouldn't see a difference by eye.

 

Link to comment
Share on other sites

Indeed this one works with the colors changing as expected (notwithstanding apparently different algorithm used by WLPG)! And indeed more sensitive too, which solves my other problem. Thanks (and for the link too)!! May I suggest posting in the Plugins section, notwithstanding that it's simple? It's a pretty useful adjustment.

Link to comment
Share on other sites

30 minutes ago, BoltBait said:

Should I move it from the Effects > Photo menu into the Adjustments menu?

 

I think YES, because it is not a special photo related effect.

Link to comment
Share on other sites

I'm going to vote for Effects > Photo. It seems a plugin which you would primarily use on ......photos! :mrgreen:

Link to comment
Share on other sites

Link to comment
Share on other sites

Yes, works great. Thanks again. Since you ask, for me it clearly belongs in the Adjustments menu since the similar linear color modifications like Hue/Saturation are there, and it is intended to correct an image, not add an artifact. Effects seem to have, appropriately, mostly enhancements to add effects not in the original picture (with the notable exception of Red Eye, but that is a non-linear adjustment at least). Either way, it's a minor point, just happy to have it.

Link to comment
Share on other sites

@BoltBait - are you going to release this in it's own thread? Please do so we can keep track of it.

Link to comment
Share on other sites

13 minutes ago, Ego Eram Reputo said:

@BoltBait - are you going to release this in it's own thread? Please do so we can keep track of it.

 

Yes, I just want to iron out any last minute bugs.  It looks pretty good now, I think the last thing is to decide which menu to put it in.

 

Once that's done, I'll publish.

Link to comment
Share on other sites

I think you should put it in your "Combined Adjustments" plugin replacing the Yellow/Blue adjustment slider. Just a thought.

 

It works great in PDN 4.0.13, it doesn't work in PDN 3.5.11.

  • Upvote 1

69unju0.gif

Link to comment
Share on other sites

9 hours ago, dipstick said:

I think you should put it in your "Combined Adjustments" plugin replacing the Yellow/Blue adjustment slider. Just a thought.

 

It works great in PDN 4.0.13, it doesn't work in PDN 3.5.11.

 

Now, there's the best idea in the thread.

 

EDIT: Done!

 

 

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