leroys Posted February 17, 2007 Share Posted February 17, 2007 Newbie here so please be kind, I plan to use Paint.net for my Nikon Nef files and wondered if there are any plans to develope a plugin for white,grey and blackpoint ref. If not, any one that is compatible? Thanks, Lee from Milwaukee Quote Leroy Allen Skalstad Link to comment Share on other sites More sharing options...
BoltBait Posted February 17, 2007 Share Posted February 17, 2007 Could you show us an example of what effect you mean? Or, are you looking for a File type support plugin? Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
leroys Posted February 17, 2007 Author Share Posted February 17, 2007 http://www.pictureflow.com/forum/showthread.php?t=7780 Thanks for the reply Boltbait. Often, In my work, Especially with existing light portraiture I will insert a white, gray and black reference card in the bottom of the image and use the above plugin in PS for exposure and color balance. As I mentioned, a newbie who is intrigued by the 64 bit architecture in Paint.net and wondered if this was also possible. Quote Leroy Allen Skalstad Link to comment Share on other sites More sharing options...
BoltBait Posted February 17, 2007 Share Posted February 17, 2007 Try using the built-in Brightness/Contrast mixed with this plugin: http://paintdotnet.12.forumer.com/viewtopic.php?t=3135 Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
leroys Posted February 17, 2007 Author Share Posted February 17, 2007 could you not just use brightness/contrast adjustment until the black and white swatches appear correct, or is there more going on in the plugin than that? Thanks User24, will try, I did calibrate my monitor with Huey from Pantone so I should be close to seeing what the Fuji Frontier outputs, Still on a learning curve so thanks for your patience, Lee Quote Leroy Allen Skalstad Link to comment Share on other sites More sharing options...
leroys Posted February 17, 2007 Author Share Posted February 17, 2007 Try using the built-in Brightness/Contrast mixed with this plugin:http://paintdotnet.12.forumer.com/viewtopic.php?t=3135 "Thanks Boltbait" Quote Leroy Allen Skalstad Link to comment Share on other sites More sharing options...
leroys Posted February 17, 2007 Author Share Posted February 17, 2007 (alternatively, learn to use your nikon properly! ) Thanks user24, You must have picked up on my awkwardness, lol "Scratching bottom of chin with pocket protector" Quote Leroy Allen Skalstad Link to comment Share on other sites More sharing options...
BoltBait Posted February 17, 2007 Share Posted February 17, 2007 I tried it with your sample image (in the post linked above) and I must say, it turned out pretty nice. I just adjusted the Brightness / Contrast up pretty high (82/61) until the general look was achieved. Then I adjusted the color balance by sliding the Yellow/Blue slider to the blue side by +10 (0/0/10). Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
usedHONDA Posted February 17, 2007 Share Posted February 17, 2007 In a way, the levels adjustment takes care of the balance. Quote "The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Ezra Pound twtr | dA | tmblr | yt | fb Link to comment Share on other sites More sharing options...
Chill Posted March 5, 2007 Share Posted March 5, 2007 Hi Another newbie here. This 'white balance' tool is something that I too missed when I discovered Paint.NET the other day. I've been playing with the CodeLab plugin in an attempt to make a suitable plugin, and I think I have the code for the effect worked out. However, I can't find a way to get at the current cursor/mouse coordinates, so my testing is a bit long-winded (note cursor coordinates, edit the plugin text). What I'd like to finish up with is a plugin that uses a new tool, with it's own cursor, and for a click with that cursor to pass the cursor coordinates to the white balance code. Can anyone point me to a similar existing plugin, or perhaps get me started with the code for cursor coordinates and mouse actions? Thanks Quote Link to comment Share on other sites More sharing options...
BoltBait Posted March 5, 2007 Share Posted March 5, 2007 Chill, there is currently now way to access the mouse location inside of an effect. One way to get around this is to instruct the user to use the Color Picker tool to select (from the image) White as the primary color and Black as the secondary color before running your effect. Getting the primary/secondary colors is trivial in an effect. Another way to handle this is to display a thumbnail in the effect's UI and capture mouse clicks from there. In a way, the levels adjustment takes care of the balance. True, but I find the levels adjustment much more difficult to use. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Chill Posted March 5, 2007 Share Posted March 5, 2007 BoltBait Thanks for your quick reply. The colour picker seems like a great idea - the user would use it to select a grey point, and my plugin would use the RGB values of the primary colour to make the adjustment. I could even allow the adjustment to be based on an average of the corrections for the primary and secondary colours, thus allowing the user to use two sample points, although I'm not sure there's a need for this. Any chance you could show me some code to access the primary and secondary colours? Thanks Quote Link to comment Share on other sites More sharing options...
barkbark00 Posted March 5, 2007 Share Posted March 5, 2007 ...Fuji Frontier... I used to support the network connectivity for those when I worked at Kodak...Ironic? Quote  Take responsibility for your own intelligence. -Rick Brewster Link to comment Share on other sites More sharing options...
BoltBait Posted March 5, 2007 Share Posted March 5, 2007 BoltBaitThanks for your quick reply. The colour picker seems like a great idea - the user would use it to select a grey point, and my plugin would use the RGB values of the primary colour to make the adjustment. I could even allow the adjustment to be based on an average of the corrections for the primary and secondary colours, thus allowing the user to use two sample points, although I'm not sure there's a need for this. Any chance you could show me some code to access the primary and secondary colours? Thanks Had you upgraded to my updated CodeLab, you wouldn't be asking me that question... http://boltbait.googlepages.com/codelab Oh, and the reason I suggested using both primary and secondary colors, is that with the user sampling White for primary and Black for secondary, you can calculate if increasing the contrast of the image is necessary. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Chill Posted March 5, 2007 Share Posted March 5, 2007 BoltBait Yes, sorry - too quick to ask for help! I found what I needed, and have implemented a very simple 'White Balance' plugin, which uses, as per your suggestion, the current Primary colour as the grey point. For what it's worth, the code is shown below (can't see how to attach the DLL at the moment). I have tested this on a few images that only needed a small white balance correction, and it seems to work OK. It could well need some work for images that have a significant colour cast, but I'm not yet familiar with how the core code copes with illegal, or out of bounds, values for the RGB values. Thanks for your help. void Render(Surface dst, Surface src, Rectangle rect) // White Balance plugin // Uses Primary colour as user-selected grey point { int r, g, b; int RShift, GShift, BShift; //local variable for primary colour ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; // RGB values of primary colour r = PrimaryColor.R; g = PrimaryColor.G; b = PrimaryColor.B; //RGB correction for primary colour - reduces this colour to grey RShift = (r+g+b)/3-r; GShift = (r+g+b)/3-g; BShift = (r+g+b)/3-b; PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { //apply RGB shifts to current pixel r = (int)src[x,y].R+RShift; g = (int)src[x,y].G+GShift; b = (int)src[x,y].B+BShift; dst[x, y] = ColorBgra.FromBgra( Utility.ClampToByte(, Utility.ClampToByte(g), Utility.ClampToByte(r), src[x,y].A); } } } } Quote Link to comment Share on other sites More sharing options...
BoltBait Posted March 5, 2007 Share Posted March 5, 2007 Nice, but you don't actually lighten up the picture at all. How about like this: void Render(Surface dst, Surface src, Rectangle rect) // White Balance plugin // Uses Primary colour as user-selected grey point { int r, g, b; int RShift, GShift, BShift; //local variable for primary colour ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; // RGB values of primary colour r = PrimaryColor.R; g = PrimaryColor.G; b = PrimaryColor.B; int brighter; brighter = (r>g)?r:g; brighter = (brighter>?brighter:b; brighter = 255-brighter; //RGB correction for primary colour - reduces this colour to grey RShift = (r+g+b)/3-r; GShift = (r+g+b)/3-g; BShift = (r+g+b)/3-b; PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); for(int y = rect.Top; y { for (int x = rect.Left; x { if (selectionRegion.IsVisible(x, y)) { //apply RGB shifts to current pixel r = (int)src[x,y].R+RShift+brighter; g = (int)src[x,y].G+GShift+brighter; b = (int)src[x,y].B+BShift+brighter; dst[x, y] = ColorBgra.FromBgra( Utility.ClampToByte(, Utility.ClampToByte(g), Utility.ClampToByte(r), src[x,y].A); } } } } This is far from perfect, but I think you get my idea. Using this on the sample image from the first page, you can see that the contrast of the image needs to be increased. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Chill Posted March 5, 2007 Share Posted March 5, 2007 BoltBait I get the idea, and it would make a nice basis for an integrated 'image improvement' tool. Your suggestion of using the primary and secondary colours to identify the whitest and blackest parts of the image is certainly interesting in that respect. However, my aim with the the white balance correction was simply to remove any colour cast introduced by, say, an inappropriate colour temperature setting in a digital camera. I'm not sure that such a situation would warrant an automatic change in brightness or contrast (I could be wrong though - it depends what else the wrong colour temperature setting does to the captured image). Personally I would prefer to see the brightness and contrast corrections left to separate tools. As originally coded, my white balance tool preserves the overall brightness (I think!), and simply applies the same shifts in red, green and blue as are necessary to make the primary colour a shade of 'pure' grey. It means that the user simply has to select a point that should have no colour - it doesn't have to be the whitest or blackest part of the image, any grey point will do. The original poster's grey card in the captured scene would be ideal in this case. Thanks again. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted March 5, 2007 Share Posted March 5, 2007 Ah, yes, my mistake. I assumed that you were after the same level of automation that the original poster was after! Yes, your script does a fine job. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Chill Posted March 5, 2007 Share Posted March 5, 2007 No, my mistake! I've just re-read the OP's post, and indeed the use of a white and black point would be useful in that case. Such a tool would have limited use, in my opinion, for the majority of casual photos that don't have absolute white and black references though. There's usually something in the image that one can confidently treat as a grey point though (T-shirt, painted structure, car tyres, clouds etc). Each to his own! Quote Link to comment Share on other sites More sharing options...
Chill Posted March 6, 2007 Share Posted March 6, 2007 BoltBait Following your subtle hint regarding your updated CodeLab plugin , I've modified my White Balance plugin using your new template (Alpha 4) as the starting point. Functionally it's no different, but for the benefit of future newbies like myself, I think it's useful to draw attention to your version. void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra CurrentPixel; int r, g, b; int RShift, GShift, BShift; //RGB values of primary colour r = PrimaryColor.R; g = PrimaryColor.G; b = PrimaryColor.B; //RGB correction for primary colour - reduces this colour to grey RShift = (r+g+b)/3-r; GShift = (r+g+b)/3-g; BShift = (r+g+b)/3-b; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; //apply RGB corrections to current pixel r = CurrentPixel.R + RShift; g = CurrentPixel.G + GShift; b = CurrentPixel.B + BShift; dst[x, y] = ColorBgra.FromBgra( Utility.ClampToByte(, Utility.ClampToByte(g), Utility.ClampToByte(r), src[x,y].A); } } } } Quote Link to comment Share on other sites More sharing options...
usedHONDA Posted March 6, 2007 Share Posted March 6, 2007 This stuff is going way over my head :shock: . Just make a plugin and call it a day Quote "The greatest thing about the Internet is that you can write anything you want and give it a false source." ~Ezra Pound twtr | dA | tmblr | yt | fb Link to comment Share on other sites More sharing options...
Chill Posted March 6, 2007 Share Posted March 6, 2007 usedHONDA Well I have - the code above will do for now, until I see that it's doing something wrong :? . I'd post the DLL, but it seems there's no way to include attachments, and I've got nowhere to host it myself. Seems like an oversight to me - shouldn't the 'Plugins' forum at least allow plugins to be attached to posts? Anyway, if you need the plugin, I suggest you paste the above code into the CodeLab plugin and use the 'Make DLL' button. EDIT: Yes I know this isn't the Plugins forum, but I checked there and I can't attach plugins in that forum either. Quote Link to comment Share on other sites More sharing options...
Ed Harvey Posted March 10, 2007 Share Posted March 10, 2007 I've got a plugin that does something similar to your idea. The effect dialog gives a 'thumbnail' of the current layer; if you click the mouse on a point within the thumbnail, then the effect will try to make that point a gray color... You can get it here White Balance Prototype Plugin. IMPORTANT: It's still very much a prototype... As always, I'd be interested to get some feedback. Ed Quote Link to comment Share on other sites More sharing options...
Chill Posted March 17, 2007 Share Posted March 17, 2007 Ed That's a nice implementation. I've been further experimenting with the code for the effect, and I've noticed some problems that maybe your implementation could help with. Firstly, using the image in the earlier post (the model, with the black and white card in the image), I found that the white section of the card has a slightly speckly quality, so that if I use the dropper to select the white point I get a different result depending on precisely which pixel I select. Secondly, I tried an implementation that attempts to 'stretch' the contrast, by using the dropper to select a black point as the secondary colour. It worked well, but again I found that different pixels within the black part of the card have slightly different colours, so the results were not consistent. Also, probably for the same reason, the black part of the card usually seemed to have a different colour cast to the white part. I achieved quite a good result by averaging the colour cast from the black and white sections. I also experimented with applying a variable colour cast, based on the brightness of the each pixel (so a dark pixel used a cast weighted to the black cast, and a light pixel used the cast weighted towards the white point). Where I think your implementation might allow an improvement is in the selection of the white (and black) point. The dropper seems to be limited to a single pixel, but a selection point that averaged the colour cast over several pixels (ie a kind of 'dropper width' setting) would probably make for a more consistent result. Chris Quote Link to comment Share on other sites More sharing options...
Ed Harvey Posted March 18, 2007 Share Posted March 18, 2007 That's a nice implementation. Thanks. I try The image that you were using has truly horrible noise; I suspect it's a poor original image compounded with heavy jpeg compression of the screen shot... The black levels are severely affected by this noise, so I'm not surprised you had problems with them. In any case, trying to correct color balance from black levels is notoriously perilous! Normally one would correct color using mid to high levels and just use the black levels to clamp the black floor. The implementation I posted does not use a single pixel selection. It averages over a 3x3 square. It's a tribute to the awfulness of the test image that even this averaging does not help. :shock: I'm still working on an improved version, which has a better correction algorithm (Bradford Chromatic Adaptation) and will have a raft of UI improvements. Ed PS Here's a quick attempt at fixing your example with my new, experimental, stuff. I'm immodest enough to believe that I've done a better job (far right) than the examples author (center) [although, ultimately, their plug-in has a lot more control than mine and could probably do a better job if used by an experienced operator.] Quote 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.