Converting 8bpp raw data to a 32bppArgb Bitmap

G

Guest

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 tell how to do it?
 
T

TerryFei

Hi Sharon,

Based on my knowledge, we can use some existed librarys to achieve this
goal, for example Free Image library. I hope the following information will
be helpful for you:
Title: C# Wrapper to the FreeImage DLL for graphical image format conversion
URL:http://www.codeproject.com/csharp/FreeImageCSWrapper.asp

Thanks for your understanding!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
 
G

Guest

I know the FreeImage and I'm using it. But it's not good for me in this case.
But I did found a simple way to do that:
(1) Create a Bitmap with the same size of the source image (buffer) but with
Format32bppArgb pixel format.
(2) Use the created bitmap graphics and draw the source image (8bpp pixel
format) onto the newly created bitmap.

Note: The raw data buffer that contains the 8bpp image data can be taken
from a Bitmap with Format8bppIndexed pixel format, then it can be written
with the relevant data, and by using my above procedure, it can be converted
to Format32bppArgb bitmap.

that is it.
 
T

TerryFei

Hi Sharon,
Thanks for your update! :)

We really appreciate your taking the time to provide us with feedback on
how you were successful in resolving this issue. I think this invaluable
experience can benefit others in the newsgroup facing this issue. Thanks
for your knowledge sharing!

Best Regards,

Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security

--------------------
 

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

Top