Sign in to follow this  

Increase Local Contrast effect plugin

Recommended Posts

I recently edited a bunch of digicam photos and encountered one memory error after another using this plugin. I have an x86 PC with 3 GB RAM and my pagefile can expand to at least 6 (?) GB. No other plugin caused problems, it was only this one, and it did it frequently and rather randomly. So I guess there's a mistake in the code. This is one of the exception logs Paint.NET showed when the plugin crashed:

Datei: C:\Program Files\Paint.NET\Effects\IncreaseLocalContrast.dll
     Effektname: MeeSoft.Paint.Net.Plugins.IncreaseLocalContrast.EffectPlugin
     Vollständige Fehlermeldung: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.OutOfMemoryException: Eine Ausnahme vom Typ "System.OutOfMemoryException" wurde ausgelöst.
  bei MeeSoft.Mathematics.LinearAlgebra.MatrixFloat32.New(Int32 nRows, Int32 nCols)
  bei MeeSoft.ImageProcessing.PlanarBitmap.New(Int32 width, Int32 height, Int32 planeCount, Double gamma)
  bei MeeSoft.ImageProcessing.PlanarBitmap.Assign(Bitmap source)
  bei MeeSoft.Paint.Net.Plugins.IncreaseLocalContrast.EffectOperation.CheckParams(EffectPluginConfigToken param, Bitmap srcBitmap)
  bei MeeSoft.Paint.Net.Plugins.IncreaseLocalContrast.EffectPlugin.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, Int32 startIndex, Int32 length)
  bei PaintDotNet.Effects.Effect.Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois)
  bei PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction()
  --- Ende der internen Ausnahmestapelüberwachung ---
  bei PaintDotNet.Effects.BackgroundEffectRenderer.Join()
  bei PaintDotNet.Effects.BackgroundEffectRenderer.Abort()
  bei PaintDotNet.Menus.EffectMenuBase.DoEffect(Effect effect, EffectConfigToken token, PdnRegion selectedRegion, PdnRegion regionToRender, Surface originalSurface, Exception& exception)

In most of the cases the crash occured when pressing the OK button, during the preview it was OK.

Also, it was only a "little" error, only the plugin "died", Paint.NET continued to run.

It works fine with smaller pics.

Share this post

Link to post
Share on other sites

Looks bad. How big are your images? I didn't see it in my tests but that was probably because I restarted PDN frequently.

This is one of my first C# projects and I don't have much experince with memory management under .net yet... I going out travelling for four weeks soon and I probably won't have time to look at it before so I will try to find a solution when I get back.

Share this post

Link to post
Share on other sites
Thank you!


But the plugin has a major rendering issue.

It happens apparently when you enlarge the image till it is shown larger than the Paint.NET window. As a consequence, the result does not replace the original, it is rendered inside the picture.



Plugin used in "window" picture size:


Plugin used (same settings) with the picture larger than the window (in my example, I enlarged it to 100% - 1024x768 - with the window around 890x630, the following image shows the result zoomed out to display the effect):


Users of Windows Vista and Windows 7 may restore the old plugin version via shadow copies ("previous versions") until a fix is provided. Note that this works only in certain editions. Interested users can use "Help and Support" for further information.

Despite any problems I want to say thanks that this plugin is still maintained and updated. Sadly, I do not understand the local maximum/minimum option. The image just turns black or white..?

Share this post

Link to post
Share on other sites
The rendering problem should be fixed now.

It is my pleasure to confirm that the plugin seems to work properly now. At least I failed in reproducing the error shown above. Thanks for the quick fix.

Just out of interest, did the old version of the plugin use the luminace or RGB based method?

Share this post

Link to post
Share on other sites

The old version used the luminace method. The luminace method will often add more contrast, but it sometimes also produces false colors, e.g. makes a big blue sky turn cyan. The RGB method should preserve the original colors perfectly.

Share this post

Link to post
Share on other sites

Any chance you can keep the version names consistent? That way they'll be overwritten as users update their plugins.

Share this post

Link to post
Share on other sites

Woah :o

I didn't even realize there were two of 'em


So what's the difference? *goes and reads* :P

Sorry for the trouble :)

Share this post

Link to post
Share on other sites

Wow, this is what I have been looking for. Thank you. Found this thread after searching extensively under HDR and High Dynamic Range ( maybe you should rename it :oP )

Its done amazing things to some random car and landscape pics I snapped with my generic 8 mp . Thanks again.

This and the BoltBait's Gaussian Blue Plus V1.1 ( set to darken and slider on 10 ) are going to work magic for me.


( took me a long time to find this after perusing many dead end HDR threads )


Edited by friendly7

Share this post

Link to post
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.

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.

Sign in to follow this