Transform 24bit BMP to grayscale??

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

I'm having trouble reducing the size of a bitmap programmatically: The file
size of the original is 2400k.
The picture is 816x1056. 16 million colors i think. I only need grayscale
render.

Public Sub ConvertBadBitmap(ByVal FilePath As String)
Dim objPicture As New Bitmap(816, 1056,
System.Drawing.Imaging.PixelFormat.Format16bppGrayScale)
objPicture = objPicture.FromFile(FilePath)
objPicture.Save("C:\ConvertPHOTO.bmp")
End Sub

I suppose the formfile is overriding the original obj properties right? but
not familiar enough with the syntax to know better. MS sight is sure no
help!

TIA
Harry
 
I have used something along the following lines successfully to adjust the
size of a bitmap. I am not too familiar with changing to grayscale.

Dim mysize as size = new size(inthorz,intVert)
Dim myBitmap As bitmap = New Bitmap(strFile)
myBitmap = new bitmap(mybitmap,mysize)
myBitmap.save(strNewFile,ImageFormat.Jpeg)
 
Thanks Mike,

As always i wasn't too clear on what i need. I actually want to keep the
same physical size but reduce the bits per pixel down to a grayscale 256
color Bitmap.

Thanks
Harry
 
Back
Top