473,322 Members | 1,510 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,322 software developers and data experts.

Problem converting to 32ARGB bitmap

I can display an 8bpp indexed bitmap correctly but when i tried to
convert this to 32ARGB then it didn't display properly at all. I am just
wondering how i can display the same 24bpp image at the the same width
and height as the previous 8bpp data. Is it possible that i can just
clone this data but i can't really as i am not allowed to create it i
think with an indexed bitmap. I set one byte to the corresponding index
color and this is how i display the 8bpp bitmap. How do i create a the
smae file but using 3 bytes for every color instead of one. I want to
keep my same width size of the actual image..how do i do that?......

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 2624
You can create a copy of the image like this..

Bitmap bm=new Bitmap(original.Width, original.Height)
Graphics g=Graphics.FromImage(bm);
g.DrawImageUnscaled(original,0,0);
g.Dispose();

bm now contains a 32bpp copy of your 8 bit image.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml


"James Dean" <m_*******@yahoo.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I can display an 8bpp indexed bitmap correctly but when i tried to
convert this to 32ARGB then it didn't display properly at all. I am just
wondering how i can display the same 24bpp image at the the same width
and height as the previous 8bpp data. Is it possible that i can just
clone this data but i can't really as i am not allowed to create it i
think with an indexed bitmap. I set one byte to the corresponding index
color and this is how i display the 8bpp bitmap. How do i create a the
smae file but using 3 bytes for every color instead of one. I want to
keep my same width size of the actual image..how do i do that?......

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
Thats great Bob thanks. I cloned the 8bpp bitmap to another bitmap but i
gave this 32ARGB pixel format. If i don't use that image unscaled i
cannot save the bitmap properly..Is there any way i can actually save
that bitmap properly in 32ARGB...or do i always have to use the
imageunscaled to display it properly. I cannot seem to set the
transparent color either.....i thought using the same graphics object if
i just went g.Clear(Color.transparent)....it would set the background
color from black to white but it didn't...why is that?.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

1
by: Gaz | last post by:
Hi all, I'm using a 3rd party Assembly that contains a method which returns bitmap data, however the Return value type is IntPtr and I need to convert it so I can access the Bitmap data: I'm...
4
by: James Dean | last post by:
I am trying to directly set the pixels in a 32ARGB image but for some reason i am not setting them correctly. I have a struct 4 bytes in size... public struct PixelData { public byte Blue;...
0
by: Mark Allen | last post by:
Hello, I am creating an RTF document server side for a report. However I am having problems converting images into the required RTF format. I am converting the image into a string (binary)...
2
by: Map Reader | last post by:
Greetings, I am converting an old VB6 application to use .NET. One of the old controls loads icons from the disk and displays them. However, the transparent color turns to blue somewhere in the...
3
by: Sharon | last post by:
I have a buffer of byte that contains a raw data of a 1 byte-per-pixel image data. I need to convert this buffer to a Bitmap of Format32bppArgb and to a Bitmap of Format24bppRgb. Can anybody...
2
by: Laurent Navarro | last post by:
Hello, I am using a library which returns a byte containing RAW data, ie all pixels' color values coded in a byte array without header. I would like to save those data into a JPEG file so I...
0
by: Oriane | last post by:
Hello there, I try to handle bitmap images stored in an Image column in Sql Server. The following code is ok when the image is of type Bitmap (*.bmp): private ImageSource...
3
by: =?Utf-8?B?dGtpZWhs?= | last post by:
I have large 1bpp tiff scans of arch. drawings that are typically 12032x16890 pixels (filesize is about a 1 meg +/-) While I can readily view smaller (dimension) files, when I try to do anything...
5
by: almurph | last post by:
RE: Tryign to convert Graphics object to a bitmap Hi, Hope you can help me with this. I have to open a file and add some text to it and then display it. So I create an Image object then...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.