Convert bitmap

  • Thread starter Thread starter Giovanni Rena
  • Start date Start date
G

Giovanni Rena

Hello,

how can I convert a bitmap file that has 16bit into a file with 1bit (black
and white)?

Thanx
 
Hello,

I'm not sure if there is any existing .Net methods that can do this for you
but from an image processing point of view it's not so difficult.
Basically you choose a threshold value. Any pixel intensity below that value
on your original image, you convert the pixel to black. Everything else will
be white.

A good choice for the threshold is the "dominant pixel value". Basically you
can determine it by finding what pixel is predominant on your original image
and you choose the intensity of that pixel as your threshold.

Hope this helps.
Sitar.
 
This should help you to work with images and .net:
http://msdn.microsoft.com/msdnmag/issues/03/07/CuttingEdge/default.aspx

You could learn some things there:
http://www.vbaccelerator.com/home/VB/Code/vbMedia/Image_Processing/index.asp

And you'll find more than what you're asking for there
http://www.efg2.com/Lab/Library/ImageProcessing/Algorithms.htm#GeneralAlgorithms

I haven't found any simple page on thresholding but once you'll be able to
load an image (first article) you'll be able to apply any kind of filters on
it.

Loop on (x,y)
GetPixelValue(x,y)
DoSomeCalculationOnPixelValue
PixelValue(x,y) = new values

You could convert to grayscale first using this method to find the new pixel
values
http://www.vbaccelerator.com/home/V...eduction_Methods_and_Gray_Scaling/article.asp

And then choose a threshold, and convert to black and white.

I'm not sure if this is clear enough :) Let me know.

Cheers,
Sitar.
 
Perfect! Thank you very much! That realy help me a lot. I was already
translating a vb code into a c# code. Althought I have no idea about these
graphic routines.

Thanx!
Giovanni
 
Back
Top