scoostraw Posted November 11, 2011 Share Posted November 11, 2011 I can't seem to find this anywhere... What I want to be able to do is click on an area of a photo, and then tell paint.net that I want this to be WHITE - and adjust the rest of the photo accordingly. ie, an object photographed on a white background that is tinted due to incandescant lighting etc. I know this feature exists in photoshop elements. Is it available in paint.net? Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 11, 2011 Share Posted November 11, 2011 Ed Harvey has a White Balance plugin in his pack: http://forums.getpaint.net/index.php?/topic/18811- Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
scoostraw Posted November 11, 2011 Author Share Posted November 11, 2011 Ed Harvey has a White Balance plugin in his pack: http://forums.getpaint.net/index.php?/topic/18811- Thanks. I just downloaded it. I don't see how to use it though.... Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 11, 2011 Share Posted November 11, 2011 How to install Paint.NET plugins. Hope this helps. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
scoostraw Posted November 11, 2011 Author Share Posted November 11, 2011 How to install Paint.NET plugins. Hope this helps. Oh yes I installed it and the feature is there. I just don't think it will do what I'm looking for. I forget what the tool is called in Elements, but it allows you to click on a spot on a photo. Elements then treats this as "WHITE" and automatically adjusts the rest of the image based on that. It's a terrific feature, and I thought it was probably common amongst photo editors. But maybe not(?) Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 12, 2011 Share Posted November 12, 2011 (edited) OK, try this plugin that I wrote a long time ago but never published: <snip> (Yes, I know it needs some work.) Edited November 16, 2011 by BoltBait Removed BETA version. See post below for new version. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Red ochre Posted November 12, 2011 Share Posted November 12, 2011 Just tried it - looks similar to the elements idea. You find it under Effects/Photo by the way (if you couldn't - like me!). - Good idea - I think it would be (is) useful. Let's hope it helps 'scoostraw'. Quote  Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings  Link to comment Share on other sites More sharing options...
scoostraw Posted November 12, 2011 Author Share Posted November 12, 2011 OK, try this plugin that I wrote a long time ago but never published: <snip> (Yes, I know it needs some work.) This is interesting. Different from what I'm used to, but maybe it will work for me. Nice work. What is the meaning/purpose of the grid lines? Quote Link to comment Share on other sites More sharing options...
scoostraw Posted November 12, 2011 Author Share Posted November 12, 2011 (edited) I don't have access to Elements at the moment, but I found a description of the feature I'm used to using. This is what I'd like to do in paint.net: "Photoshop Elements has a color cast correction feature. When you select it, you get an eye dropper tool that you use to sample a white or gray point in the photo. It will use that point as white and will correct the cast." This is an extremely useful tool. Edited November 12, 2011 by scoostraw Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 12, 2011 Share Posted November 12, 2011 What is the meaning/purpose of the grid lines? They help you see exactly what pixel is being selected. The + sign is not too easy to see what pixel is being selected. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
scoostraw Posted November 12, 2011 Author Share Posted November 12, 2011 They help you see exactly what pixel is being selected. The + sign is not too easy to see what pixel is being selected. Ahhhhh... ok got it. Very nice. Are you going to officially publish this plugin? I think it works great! Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 12, 2011 Share Posted November 12, 2011 Maybe. It still needs lots of work. The algorithm needs tweeking and so does the UI. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Red ochre Posted November 12, 2011 Share Posted November 12, 2011 May I suggest (only an idea), - that instead of the double vector UI, you could simply let the user set the primary color using the ink dropper tool. And use that as the selected 'white' value? It would be more logical to use the secondary color though - but that may mean you'd have to write a 'black balance' version too! Only a suggestion - (it would make the 'white' selection more accurate). - I know how much work can be involved, even starting from an apparently simple idea. But I think it could be useful plugin. Quote  Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings  Link to comment Share on other sites More sharing options...
scoostraw Posted November 12, 2011 Author Share Posted November 12, 2011 May I suggest (only an idea), - that instead of the double vector UI, you could simply let the user set the primary color using the ink dropper tool. And use that as the selected 'white' value? It would be more logical to use the secondary color though - but that may mean you'd have to write a 'black balance' version too! Only a suggestion - (it would make the 'white' selection more accurate). - I know how much work can be involved, even starting from an apparently simple idea. But I think it could be useful plugin. I second Red's motion. All those in favor? (AYE!!) Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 13, 2011 Share Posted November 13, 2011 Ok, I'll work something this weekend. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Djisves Posted November 13, 2011 Share Posted November 13, 2011 Yipee! Quote Link to comment Share on other sites More sharing options...
BoltBait Posted November 16, 2011 Share Posted November 16, 2011 OK, how about this one: BBWhiteBalance.zip Use the eye dropper tool to set your primary color before running the effect. Or, you can use the cross hairs to select a white pixel. The effect shows up under the Effects > Photo > White Balance... menu. Here's the CodeLab script: // Title: BoltBait's White Balance v3.5 // Author: BoltBait // Submenu: Photo // Name: White Balance // URL: http://www.BoltBait.com/pdn #region UICode ColorBgra Amount1 = ColorBgra.FromBgr(0,0,0); // Select color of pixel that represents white bool Amount2 = false; // [0,1] Use manual selection instead Pair<double, double> Amount3 = Pair.Create( 0.0 , 0.0 ); // Manual white position selection bool Amount4 = false; // [0,1] Show guide lines #endregion private byte Clamp2Byte(int iValue) { if (iValue > 255) return 255; if (iValue < 0) return 0; return (byte)iValue; } private UnaryPixelOps.Invert invertOp = new UnaryPixelOps.Invert(); // Here is the main render loop function unsafe void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int RedAdjust = 0; int BlueAdjust = 0; int GreenAdjust = 0; int column; int row; // find manual selected pixel int width = selection.Right - selection.Left; int height = selection.Bottom - selection.Top; double px = (Amount3.First + 1) / 2; double py = (Amount3.Second + 1) / 2; column = (int)Math.Truncate(px * (width-1)); row = (int)Math.Truncate(py * (height-1)); // default to primary color for adjustment ColorBgra SourceColor = Amount1; // if selected, use the manual selected pixel instead if (Amount2) { SourceColor = src[column,row]; } // Calculate the amount of Red, Green, and Blue to adjust each pixel // We'll assume Blue is in the center BlueAdjust = 0; RedAdjust = SourceColor.B - SourceColor.R; GreenAdjust = SourceColor.B - SourceColor.G; // Now, check to see if Red is in the center if (((SourceColor.R <= SourceColor. && (SourceColor.R >= SourceColor.G)) || ((SourceColor.R >= SourceColor. && (SourceColor.R <= SourceColor.G))) { RedAdjust = 0; BlueAdjust = SourceColor.R - SourceColor.B; GreenAdjust = SourceColor.R - SourceColor.G; } // Or, is it Green that's in the center else if (((SourceColor.G <= SourceColor.R) && (SourceColor.G >= SourceColor.) || ((SourceColor.G >= SourceColor.R) && (SourceColor.G <= SourceColor.)) { GreenAdjust = 0; RedAdjust = SourceColor.G - SourceColor.R; BlueAdjust = SourceColor.G - SourceColor.B; } // Apply the ajustment to each pixel for (int y = rect.Top; y < rect.Bottom; y++) { 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 (Amount4 && Amount2) { if (x == column || y == row) { if (x == column && y == row) { CurrentPixel = ColorBgra.FromBgra( Clamp2Byte(CurrentPixel.B + BlueAdjust), Clamp2Byte(CurrentPixel.G + GreenAdjust), Clamp2Byte(CurrentPixel.R + RedAdjust), CurrentPixel.A); } else { CurrentPixel = invertOp.Apply(CurrentPixel); } } else { CurrentPixel = ColorBgra.FromBgra( Clamp2Byte(CurrentPixel.B + BlueAdjust), Clamp2Byte(CurrentPixel.G + GreenAdjust), Clamp2Byte(CurrentPixel.R + RedAdjust), CurrentPixel.A); } } else { CurrentPixel = ColorBgra.FromBgra( Clamp2Byte(CurrentPixel.B + BlueAdjust), Clamp2Byte(CurrentPixel.G + GreenAdjust), Clamp2Byte(CurrentPixel.R + RedAdjust), CurrentPixel.A); } *dstPtr = CurrentPixel; srcPtr++; dstPtr++; } } } Â I wrote this myself, so I can not vouch for the algorithm. 1 Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Red ochre Posted November 18, 2011 Share Posted November 18, 2011 Nice work! - and thanks for showing the code too 1. The UI is great allowing both methods of selection and color change on the fly. 2. It appears to behave pretty much the same behavior as the PS elements version I've got - which I guess is the idea. 3. I'm a bit confused with the elements version anyway. - it says to select an area you wish to become white, grey or black - but it doesn't actually do this (still leaves a slight color caste)? Still, it's what people used to P.S. will be expecting. Personally I prefer tinkering around with curves - but that is a lot more time consuming. Thanks for putting the work in! Quote  Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings  Link to comment Share on other sites More sharing options...
BoltBait Posted November 18, 2011 Share Posted November 18, 2011 Thanks. Technically, this isn't "white balance". It is more like "gray balance". You can select a pixel that is supposed to be anywhere from white to black and the picture will be adjusted so that this pixel is gray balanced (that is: R, G, and B will be all the same value). I wrote the algorithm to try and minimize the adjustment made to the pixel. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Red ochre Posted November 19, 2011 Share Posted November 19, 2011 (edited) That's what I thought it should do - perhaps it's just my eyes - color is very subjective (dependent on the adjoining colors). So, if, lets say a 'cream' coloured pixel is selected it should change to a high value neutral grey, say B= G = R = 200 ish. And then change the rest of the picture by the ratio that caused that change? I don't think P.S is doing that - but I could well be wrong - I often am Edit - YES - I am wrong - both yours and PS do what they should - just my perception of the colors! Edited November 19, 2011 by Red ochre Quote  Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings  Link to comment Share on other sites More sharing options...
Djisves Posted November 20, 2011 Share Posted November 20, 2011 Very useful BB. Thank you. Quote Link to comment Share on other sites More sharing options...
Lance McKnight Posted November 22, 2011 Share Posted November 22, 2011 This topic had my interest as I used PDN to do photo editing. I use the following technique to "correct" white balance. BoltBait is right, it's a grey card technique, and professional photographer use grey card to calibrate their equipment to have true white balance in their photograph. To achieve it without plug-in- 1) Expand canvas size 100 pixels on the largest side, tick maintain proportion to on. 2) Use the color wheel and select either grey or light grey as the primary color, and bucket fill it around the white border. Sometime the grey color will overlap the photograph. One trick I have discovered is to set the secondary color to full transparency before changing canvas size. 3) Run levels (don't use Auto Level!) and adjust settings until you perceive the color to be desirable and pleasing to the eyes. 4) Set the canvas back to the original size (-100 pixels on the largest side). Enjoy the fruit of thy labor! Quote Officially retired from this forum. Have a nice day. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.