HighTechTalks DotNet Forums  

Determining image lighting

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Determining image lighting in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
SStory
 
Posts: n/a

Default Determining image lighting - 03-15-2006 , 10:16 AM






I am drawing a selector on my image for cropping purposes. It is done in
black, however if the image is real dark this doesn't show up well.

How can I determine the darkness of an image, or areas of an image so that I
can know whether to use black or white?

Is there a better way?

Thanks,

Shane



Reply With Quote
  #2  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Determining image lighting - 03-15-2006 , 12:56 PM






You can use the Color.GetBrightness method to get the brightness of any
given pixel.

Using perhaps an average brightness of an area you can choose an appropriate
cursor.

An alternative would be to draw a cursor around the mouse position using
drawing commands from the ControlPaint.DrawReversiblexxxx methods.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



"SStory" <nospam (AT) nospam (DOT) com> wrote

Quote:
I am drawing a selector on my image for cropping purposes. It is done in
black, however if the image is real dark this doesn't show up well.

How can I determine the darkness of an image, or areas of an image so that
I can know whether to use black or white?

Is there a better way?

Thanks,

Shane




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.