473,606 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transform 24bit BMP to grayscale??

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

Public Sub ConvertBadBitma p(ByVal FilePath As String)
Dim objPicture As New Bitmap(816, 1056,
System.Drawing. Imaging.PixelFo rmat.Format16bp pGrayScale)
objPicture = objPicture.From File(FilePath)
objPicture.Save ("C:\ConvertPHO TO.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
Nov 17 '05 #1
2 3822
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,in tVert)
Dim myBitmap As bitmap = New Bitmap(strFile)
myBitmap = new bitmap(mybitmap ,mysize)
myBitmap.save(s trNewFile,Image Format.Jpeg)

"Harry Simpson" <hs*******@nosp amphgt.net> wrote in message
news:ei******** ******@TK2MSFTN GP09.phx.gbl...
I'm having trouble reducing the size of a bitmap programmaticall y: The file size of the original is 2400k.
The picture is 816x1056. 16 million colors i think. I only need grayscale render.

Public Sub ConvertBadBitma p(ByVal FilePath As String)
Dim objPicture As New Bitmap(816, 1056,
System.Drawing. Imaging.PixelFo rmat.Format16bp pGrayScale)
objPicture = objPicture.From File(FilePath)
objPicture.Save ("C:\ConvertPHO TO.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

Nov 17 '05 #2
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

"vMike" <Mi************ @nospam.gewarre n.com.delete> wrote in message
news:bn******** **@ngspool-d02.news.aol.co m...
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,in tVert)
Dim myBitmap As bitmap = New Bitmap(strFile)
myBitmap = new bitmap(mybitmap ,mysize)
myBitmap.save(s trNewFile,Image Format.Jpeg)

"Harry Simpson" <hs*******@nosp amphgt.net> wrote in message
news:ei******** ******@TK2MSFTN GP09.phx.gbl...
I'm having trouble reducing the size of a bitmap programmaticall y: The

file
size of the original is 2400k.
The picture is 816x1056. 16 million colors i think. I only need

grayscale
render.

Public Sub ConvertBadBitma p(ByVal FilePath As String)
Dim objPicture As New Bitmap(816, 1056,
System.Drawing. Imaging.PixelFo rmat.Format16bp pGrayScale)
objPicture = objPicture.From File(FilePath)
objPicture.Save ("C:\ConvertPHO TO.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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3980
by: tjh | last post by:
hi - i'm a bit new to PHP - i've been messing around with the GD2 image functions and was wondering: i see a lot of information about converting a color image to grayscale but i can't figure out how to determine whether an image (GIF or JPG) is grayscale in the first place. is there a way to do this in PHP?
0
6869
by: Java script Dude | last post by:
In trying to speed up my web pages, I want to avoid using multiple images (disabled, hover, nohover). I've currently got opacity working on hover and it looks great and works in IE and Moz. But I now need a grayscale filter to show the image as disabled. Does anybody know of a Mozilla way of doing this. I know that -moz-opacity works for mozilla, is there an equivalent for grayscale? Thanks, JsD
6
3304
by: QuasiChameleon | last post by:
Hi, I'm trying to create a grayscale image class that reads and writes grayscale Targa format. This works well with smaller images, but corrupts larger images and creates a "Segmentation fault (core dumped)" error. I am at a loss as to why this works only part of the time. I hope it's proper etiquette to post the code below (3 files). Can someone please show me what's wrong with the following code? I
8
11391
by: RicercatoreSbadato | last post by:
I'm using bmp.Save() and the bmp is in PixelFormat.Format8bppIndexed. But when I open the image with Gimp, it tells me that the image is RGB and not grayscale.
0
2127
by: tlemcenvisit | last post by:
Hello I translated this code (witch convert an image to grayscale) from C#.NET to C++.NET The C#.NET code is : private void GrayScale(Bitmap b) { BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb); int stride = bmData.Stride;
2
3260
by: Henry Wu | last post by:
Hi I was at the search for making e.Graphics.DrawImage turn any image to Grayscale, and I found two similar solutions but different ColorMatrix values, what is the difference between the two? Is there an industry standard for the GrayScale ColorMatrix values? Thanks, Henry Solution #1, Jacob Grass:
4
6892
by: Brian L. Troutwine | last post by:
I've recently begun to teach myself pygame by making a bunch of small toys. My current toy is cellular automata displayer and I've gotten a bit stuck on the displaying bit. (If automata isn't the plural of automaton please forgive me.) The current automata are only binary and are calculated using 2D Numeric arrays. It had been my assumption that once the automata was calculated I could then multiply the entire array by 255 to get a nice...
8
47890
by: platinumhimani | last post by:
-How to convert any image(8,16,24,32 or 64-bit) to 8-bit grayscale -i have tried to convert a 24-bit image to grayscale using setpixel and getpixel functions, in vb.net but i am unable to save that image in grayscale format.How do i do that.It still saves in true color format. -i used picturebox1.image.save() method -i tried to convert an 8-bit image into grayscale but was unable to do it.
5
2371
by: Speed | last post by:
Hi, I have a monochrome camera connected to my computer through the USB port. I would like to capture the images from it using C++ and save them as 8-bit grayscale Bitmaps. I am using MS Visual Studio .NET 2005. Could you please point me in the right direction. Thanks a ton.
0
8015
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5465
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2448
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1296
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.