By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,366 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,366 IT Pros & Developers. It's quick & easy.

Converting 8bpp raw data to a 32bppArgb Bitmap

P: n/a
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?
------
Thanks
Sharon
Feb 27 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/Fr...eCSWrapper.asp

Thanks for your understanding!

Best Regards,

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

--------------------
Thread-Topic: Converting 8bpp raw data to a 32bppArgb Bitmap
thread-index: AcY7fEKl6dH+VRzqSJCc3IvuqXa8QA==
X-WBNR-Posting-Host: 199.203.93.141
From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgroups.nospam>
Subject: Converting 8bpp raw data to a 32bppArgb Bitmap
Date: Mon, 27 Feb 2006 01:00:30 -0800
Lines: 11
Message-ID: <61**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.csharp:388592
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

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 Bitmapof Format24bppRgb.

Can anybody tell how to do it?
------
Thanks
Sharon


Feb 28 '06 #2

P: n/a
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.
-------
Thanks
Sharon
Feb 28 '06 #3

P: n/a
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

--------------------
Thread-Topic: Converting 8bpp raw data to a 32bppArgb Bitmap
thread-index: AcY8PS1ArfHdre8oS4COkBfiDyMlEA==
X-WBNR-Posting-Host: 199.203.93.141
From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgroups.nospam>
References: <61**********************************@microsoft.co m> <Om**************@TK2MSFTNGXA03.phx.gbl>Subject: RE: Converting 8bpp raw data to a 32bppArgb Bitmap
Date: Tue, 28 Feb 2006 00:01:27 -0800
Lines: 18
Message-ID: <1C**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:388830
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

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 withFormat32bppArgb 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 convertedto Format32bppArgb bitmap.

that is it.
-------
Thanks
Sharon


Mar 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.