|
-
May 23rd, 2004, 04:20 PM
#1
Thread Starter
Frenzied Member
byte array to bitmap and back?
Anyone know how to convert back and forth between a System.Drawing.Bitmap and a byte[]?
Last edited by Magiaus; May 24th, 2004 at 09:26 AM.
Magiaus
If I helped give me some points.
-
May 23rd, 2004, 11:17 PM
#2
hmmmmm
what do you mean by that? you want the color values in a bitmap? or what
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 24th, 2004, 09:26 AM
#3
Thread Starter
Frenzied Member
I want the actual bytes of the file but I don't want to write a file
Magiaus
If I helped give me some points.
-
May 24th, 2004, 01:02 PM
#4
have you tried the MemoryStream class ( in System.IO ) , eg:
PHP Code:
Bitmap bmp=new Bitmap(300 , 300);
Graphics grp = Graphics.FromImage(bmp);
Pen pn = new Pen(new SolidBrush(Color.BlueViolet),(float)5);
grp.DrawRectangle( pn , 10 , 10 , 100 , 100 );
grp.DrawString("test 123" , this.Font , new SolidBrush(Color.Red),new RectangleF(12 , 12 , 200,200));
System.IO.MemoryStream ByteStream = new System.IO.MemoryStream();
bmp.Save(ByteStream , System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes = ByteStream.ToArray(); // put the Bitmap into a byte array.
ByteStream.Close();
bmp.Dispose();
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
May 24th, 2004, 02:18 PM
#5
Thread Starter
Frenzied Member
So I can just Save to a stream that way eh..? cool.
Magiaus
If I helped give me some points.
-
May 24th, 2004, 03:48 PM
#6
hmm very interesting... could you tell me what use do you have for that though?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 25th, 2004, 12:41 AM
#7
Thread Starter
Frenzied Member
I have picture that are uploaded to a website. The binary info is then put in SQLServer. I need to be able to get a bitmap incase I want to edit it or something later. Plus, my code runs a web optimize on the graphics an converts them all to jpeg. This can be done at any time by admin. Full resize and so on to save space in SQL Server. Well, it did before my resize calculation blew up today. I hate 0.
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|