473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

16bppGrayScale



Anyone know how to create a 16bppGrayScale? The following code
crashes at the save statement with an OutOfMemory exception:

bmpTemp = new Bitmap(bmpBuffer.Width, bmpBuffer.Height,
PixelFormat.Format16bppGrayScale);
bmpTemp.Save(ImageSaveFileDlg.FileName);

Am I missing a pallete initialization or something? This is simply a
test snipet to test creating a GrayScale bitmap. I was expecting it to
save a blank or random-noise bitmap
Mar 1 '08 #1
2 2612
None of the 16 bit encoders for GDI+ work. This is a long standing and well
known problem.

--
--
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.
"bern11" <be****@yahoo.comwrote in message
news:zZ******************************@comcast.com. ..
>

Anyone know how to create a 16bppGrayScale? The following code
crashes at the save statement with an OutOfMemory exception:

bmpTemp = new Bitmap(bmpBuffer.Width, bmpBuffer.Height,
PixelFormat.Format16bppGrayScale);
bmpTemp.Save(ImageSaveFileDlg.FileName);

Am I missing a pallete initialization or something? This is simply a test
snipet to test creating a GrayScale bitmap. I was expecting it to save a
blank or random-noise bitmap
Mar 1 '08 #2
On Sat, 01 Mar 2008 17:51:02 -0800, bern11 <be****@yahoo.comwrote:
>
I had seen some references to formats not working, but I did get
these 16 bit formats to work: Format16bppArgb1555, Format16bppRgb555,
Format16bppRgb565 with an idiot-simple clone statement such as:

bmpTemp = bmpBuffer.Clone(new Rectangle(0, 0, bmpBuffer.Width,
bmpBuffer.Height), PixelFormat.Format16bppArgb1555);

I can't get the indexed formats to work though...
Well, you're better off than I am. I couldn't even get all of those
formats to work via cloning. :( Rgb555 and Rgb565 worked, but the
Argb1555 threw the same out-of-memory exception I get with other
unsupported formats. And the formats that work with cloning, they work
fine just creating a bitmap from scratch too (i.e. the cloning is a red
herring).

Pete
Mar 2 '08 #3

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

Similar topics

4
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.
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.