M
mo
Hi,
I have the following code to create a thumbnail from the input stream
System.Drawing.Image source;
source=System.Drawing.Image.FromStream(new
System.IO.MemoryStream(myData));
System.Drawing.Image image = source.GetThumbnailImage
150,150,null,IntPtr.Zero);
MemoryStream ms = new MemoryStream();
ImageFormat thisformat=image.RawFormat;
Bitmap imagebitmap = new Bitmap(image,150,150);
imagebitmap.Save(ms,thisformat);
ms.Seek(0,SeekOrigin.Begin);
byte[] SmallmyData = new byte[ms.Length];
FileStream newFile = new FileStream(strPath, FileMode.Create);
newFile.Write(Buffer, 0, SmallmyData.Length);
newFile.Close();
Two problems I have
1) imagebitmap.Save(ms,thisformat); line faults and cannot find the
value for thisformat (It works if I replace it with ImageFormat.Jpeg)
2) the file that gets created is corrupt.
ANy help is greatly appreciated.
Thanks,
Mo
I have the following code to create a thumbnail from the input stream
System.Drawing.Image source;
source=System.Drawing.Image.FromStream(new
System.IO.MemoryStream(myData));
System.Drawing.Image image = source.GetThumbnailImage
150,150,null,IntPtr.Zero);
MemoryStream ms = new MemoryStream();
ImageFormat thisformat=image.RawFormat;
Bitmap imagebitmap = new Bitmap(image,150,150);
imagebitmap.Save(ms,thisformat);
ms.Seek(0,SeekOrigin.Begin);
byte[] SmallmyData = new byte[ms.Length];
FileStream newFile = new FileStream(strPath, FileMode.Create);
newFile.Write(Buffer, 0, SmallmyData.Length);
newFile.Close();
Two problems I have
1) imagebitmap.Save(ms,thisformat); line faults and cannot find the
value for thisformat (It works if I replace it with ImageFormat.Jpeg)
2) the file that gets created is corrupt.
ANy help is greatly appreciated.
Thanks,
Mo