Transform 24bit BMP to grayscale??

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
 
V

vMike

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)
 
H

Harry Simpson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top