Hello.
you can use
Image.GetThumbnailImage Method
to perform this task.
see MSDN here:
http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2[
^]
that's a code example of what you could do:
public bool ThumbnailCallback()
{
return false;
}
DataTable dt3 = dbo.GetRecordsWithQuery("select id,'' as url,image,'' as thumb from Image order by id desc");
for (int i = 0; i < dt3.Rows.Count; i++)
{
byte[] val = (byte[])dt3.Rows[i][2];
MemoryStream ms = new MemoryStream(val);
System.Drawing.Image newImage = System.Drawing.Image.FromStream(ms);
newImage.Save(Server.MapPath("~/Images/temp/img" + i.ToString() + ".jpg"));
dt3.Rows[i][1] = "Images/temp/img" + i.ToString() + ".jpg";
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
Image myThumbnail = newImage.GetThumbnailImage(40, 40, myCallback, IntPtr.Zero);
e.Graphics.DrawImage(myThumbnail, 150, 75);
myThumbnail .Save(Server.MapPath("~/Images/temp/thumb" + i.ToString() + ".jpg"));
}
Valery.