"Ron M. Newman" <co**********@confideltial.com> wrote:
I'm interested in the process of taking a live bitmap oject with an image
already loaded in it, and representing it as a string such that a whole
bitmap carrying the same image can be constructed using only that string. It
doesn't HAVE to be a string, it could be an array of bytes or whatever, as
long as I can write code that converts it to a string carrying hex code
someting like "FF00FF" etc.
---8<---
using System;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using System.Windows.Forms;
class App
{
static void Main(string[] args)
{
MemoryStream temp = new MemoryStream();
using (Image image = Image.FromFile(args[0]))
image.Save(temp, ImageFormat.Jpeg);
temp.Position = 0;
string asString = Convert.ToBase64String(temp.ToArray());
Console.WriteLine(asString);
MemoryStream loaded = new
MemoryStream(Convert.FromBase64String(asString));
using (Image image = Image.FromStream(loaded))
{
Form form = new Form();
form.Paint += delegate(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(image, Point.Empty);
};
form.ClientSize = image.Size;
Application.Run(form);
}
}
}
--->8---
-- Barry
--
http://barrkel.blogspot.com/