E
Earl
I have an image issue that I do not understand. When I try to save a bitmap
created from a picturebox image, I can save without exception so long as the
bitmap was retrieved from a file and loaded into the picturebox. But if I
load the image from the database into the picturebox and try to save
(without change), I then get a null exception telling me that the encoder
parameter is null. I'm speculating that the file provides the encoder param
but the database image does not. What do I need to know to resolve this?
int intWidth = pb.Width;
int intHeight = pb.Height;
Bitmap bmp = new Bitmap(pb.Image, intWidth, intHeight);
MemoryStream ms = new MemoryStream();
bmp.Save(ms, pb.Image.RawFormat);
arrayImage = ms.GetBuffer();
ms.Close();
created from a picturebox image, I can save without exception so long as the
bitmap was retrieved from a file and loaded into the picturebox. But if I
load the image from the database into the picturebox and try to save
(without change), I then get a null exception telling me that the encoder
parameter is null. I'm speculating that the file provides the encoder param
but the database image does not. What do I need to know to resolve this?
int intWidth = pb.Width;
int intHeight = pb.Height;
Bitmap bmp = new Bitmap(pb.Image, intWidth, intHeight);
MemoryStream ms = new MemoryStream();
bmp.Save(ms, pb.Image.RawFormat);
arrayImage = ms.GetBuffer();
ms.Close();