473,799 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bitmap conversion

I'm trying to convert byte array (valid bitmap format) into some bitmaps and
back to byte array again. But when I inspect the content of the array
before and after the conversion they are different. I'm used the following
code to do the conversion. May any of you tell me what's happening?

Thanks,

Here are my code....
internal static Bitmap convertImage(st ring imageText)

{ imageText = imageText.Repla ce("\r\n", String.Empty);

Byte[] bitmapData;

bitmapData = Convert.FromBas e64String(image Text);

MemoryStream streamBitmap = new MemoryStream(bi tmapData);

return new Bitmap(streamBi tmap);}

}

internal static string convertBase64Ar ray(Bitmap bmp)

{ MemoryStream bmpStream = new MemoryStream();

bmp.Save(bmpStr eam, System.Drawing. Imaging.ImageFo rmat.Bmp);

byte[] bmpArray = new byte[bmpStream.Lengt h];

bmpStream.Read( bmpArray, 0, Convert.ToInt32 (bmpStream.Leng th));

return Convert.ToBase6 4String(bmpArra y);}
--
-----------------------------------------------------------------
Isaac Yuen
CEM
University of Alberta
iy***@ualberta. construction.ca
-----------------------------------------------------------------

| University of Alberta
| Phone: (780) 492-2276
| Fax: (780) 492-0249

Nov 16 '05 #1
2 4648
iyuen wrote:
I'm trying to convert byte array (valid bitmap format) into some bitmaps and
back to byte array again. But when I inspect the content of the array
before and after the conversion they are different. I'm used the following
code to do the conversion. May any of you tell me what's happening?

Thanks,

Here are my code....


Did you check if the result of conversion is still a valid bmp? If yes,
may be it just has changed some characteristic like number of colors?

Vadim Chekan.
Nov 16 '05 #2
How would I be able to do that to check if it's valid beside showing it on a
form?
Well...i've used ImageFormat.Mem oryBmp instead and it throws me an
exception.....

--
-----------------------------------------------------------------
Isaac Yuen
CEM
University of Alberta
iy***@ualberta. construction.ca
-----------------------------------------------------------------

| University of Alberta
| Phone: (780) 492-2276
| Fax: (780) 492-0249
"Vadim Chekan" <re************ *****@rogers.co m> wrote in message
news:3l******** ************@tw ister01.bloor.i s.net.cable.rog ers.com...
iyuen wrote:
I'm trying to convert byte array (valid bitmap format) into some bitmaps and back to byte array again. But when I inspect the content of the array
before and after the conversion they are different. I'm used the following code to do the conversion. May any of you tell me what's happening?

Thanks,

Here are my code....


Did you check if the result of conversion is still a valid bmp? If yes,
may be it just has changed some characteristic like number of colors?

Vadim Chekan.

Nov 16 '05 #3

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

Similar topics

2
4906
by: chulhee | last post by:
I have a table named 'touchpoint' which contains about 20 millions of rows. I created a bitmap index on a column named 'reason_cd' which has 7 distinct values: 'IN', 'FR', 'OP', 'CM', 'SV', 'ME', and null. However, If you take a look at the explain plan for a script like this, The oracle choose to do full access which is unexpected. select * from touchpoint where reason_cd in ('OP', 'SV')
3
33580
by: Flix | last post by:
Is there some way to convert a Bitmap from one PixelFormat (16bit or with indexed colors) to another(24bit), without doing per pixel operations?
1
4314
by: The Confessor | last post by:
The following code: MapGraphics(ListBox_Graphics.SelectedIndex - 1).MapBitmap = System.Drawing.Bitmap.FromFile(OpenFileDialog_SelectFile.FileName) incurs the following error: Option Strict On disallows implicit conversions from 'System.Drawing.Image' to 'System.Drawing.Bitmap'.
3
6125
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 tell how to do it? ------ Thanks
4
13300
by: Andrew | last post by:
Hi, I'm trying to blit small bitmaps onto a larger bitmap, and I've got a few issues wrt positioning and output size. I think my problems are due to DPI differences... My small images are 72 DPI My Large image (which i need to create in code) needs to be 300 DPI.
0
1323
by: Craig | last post by:
Hi there, This could be a curly question. When I created the x11 bitmap image using the im.tobitmap() function I found out later that the display information in the array is big endian (I think) but I want little endian. Basically if an image byte in the X11 format is 00111101 (0x3D), I want 10111100(0xBC). Is there an easy way to flip the bits after the im.tobitmap() conversion has been done or do I have to find another way? If you...
10
26344
by: Pramod Kadur | last post by:
Hello All, I need to convert the bitmap image to hexadecimal, so is there any free tool for doing this conversion? Any other suggestion is always welcome. Thank you in advance. Regards, Pramod
1
2678
by: TG01 | last post by:
I cannot clone a bitmap.. the error on the offending line says: Cannot implicitly convert type 'object' to 'System.Drawing.Bitmap'. An explicit conversion exists (are you missing a cast?) below is the code where is happens , the last line raises the error. private Bitmap _backBuffer; private Bitmap _copyBackBuffer; protected override void OnPaint(PaintEventArgs e) {
0
1601
by: Duracel | last post by:
Hi, I've got a routine that fetches a bitmap from a COM server and converts it into a .NET format bitmap. The original DIB surface is 24 bit. When blitting this bitmap to a window, the speed is pretty good when the window is around 1/4 the size of the screen, but if I go maximise the window, it slows to a crawl (relative crawl). Anyway, I've read some blogs about how to increase the speed, including using GDI instead of GDI+,...
0
9687
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
9541
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
10252
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...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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
9073
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...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
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...
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.