473,765 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting 8bpp raw data to a 32bppArgb Bitmap

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
3 6107
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+VRz qSJCc3IvuqXa8QA ==
X-WBNR-Posting-Host: 199.203.93.141
From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam>
Subject: Converting 8bpp raw data to a 32bppArgb Bitmap
Date: Mon, 27 Feb 2006 01:00:30 -0800
Lines: 11
Message-ID: <61************ *************** *******@microso ft.com>
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.publi c.dotnet.langua ges.csharp
NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3885 92
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
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 Format8bppIndex ed 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
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: AcY8PS1ArfHdre8 oS4COkBfiDyMlEA ==
X-WBNR-Posting-Host: 199.203.93.141
From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgr oups.nospam>
References: <61************ *************** *******@microso ft.com> <Om************ **@TK2MSFTNGXA0 3.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************ *************** *******@microso ft.com>
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.publi c.dotnet.langua ges.csharp
Path: TK2MSFTNGXA03.p hx.gbl
Xref: TK2MSFTNGXA03.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3888 30
NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 withFormat32bppArg b 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 Format8bppIndex ed 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5074
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 trying to use a Callback function: public delegate My_RETURN STATE_CALLBACK( IntPtr GuiStateCallbackCtx,
8
4567
by: iyuen | last post by:
I'm having problems with converting a byte array to an image object~ My byte array is an picture in VB6 StdPicture format. I've used propertybag to convert the picture into base64Array format in XML, and embedded the array as some child element in an xml file, i.e.: <Mask>bHQAAH4AAABCTX4AAAAAAAAAPgAAACgAAAAQAAAAEAAAAAEAAQAAAAAAQAAAAAAAAAAAAA AA AAAAAAAAAAAAAAAA////AP//AAD//wAA//8AAP//AAD/7wAA//cAALtzAABVeQAAVUAAAFVA...
2
2655
by: James Dean | last post by:
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...
0
1767
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) and including the image syntax as per the RTF Specification, however the image is not appearing when I view the document in Word or WordPad.
2
6195
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 process. I narrowed it down to the conversion to IPictureDisp by first loading and saving the icon as a bitmap with no problems; and then repeating the process but adding the step of converting to an IPictureDisp as well. The first operation...
2
7104
by: heathimself | last post by:
Hi, I don't know what type of files they are, but the script allows me to save to a bitmap just fine. But I do know they need to be in RGBA 4444 format, so I've followed what most of the tutorials for RGBA conversions said to do...shifting the bytes. The major problem is that everything is in green, it's shifted up by x pixels, and it's..um..flipped from left to right. I've been working on this for a few weeks now and any insight to the...
2
10353
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 tried to use the MetaFile class. byte data; (...) // Creating the RAW image through the DLL call. MemoryStream memoryStream = new MemoryStream(data);
0
1286
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 ConvertByteArrayToImageSource(byte bdIconeArray) { ImageSource imgSource = null; MemoryStream strm = new MemoryStream(); BitmapImage bitmap = new BitmapImage();
5
9423
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 import it into a Graphics object and add the text. I then try converting it to a bitmap image using the following line:
0
9568
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
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
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...
0
9832
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
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
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
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.