T
Tomo
I have some code for resizing image (create thumbnail) but there is no
compression. Thumbnail image is smaller in pixels, but in kilobytes is
bigger. How can I create smaller file? I need code in VB or C#.
// Get the path of the original Image
string displayedImg = Server.MapPath("~") + "/Testing.jpg";
// Get the path of the Thumb folder
string displayedImgThumb = Server.MapPath("~") + "/Images/";
// Get the original image file name
string imgFileName = System.IO.Path.GetFileName(displayedImg);
// Load original image
System.Drawing.Image myimg = System.Drawing.Image.FromFile(displayedImg);
// Get the thumbnail 100 X 100 px
myimg = myimg.GetThumbnailImage(1280, 825, null, IntPtr.Zero);
// Save the new thumbnail image
myimg.Save(displayedImgThumb + imgFileName, myimg.RawFormat);
compression. Thumbnail image is smaller in pixels, but in kilobytes is
bigger. How can I create smaller file? I need code in VB or C#.
// Get the path of the original Image
string displayedImg = Server.MapPath("~") + "/Testing.jpg";
// Get the path of the Thumb folder
string displayedImgThumb = Server.MapPath("~") + "/Images/";
// Get the original image file name
string imgFileName = System.IO.Path.GetFileName(displayedImg);
// Load original image
System.Drawing.Image myimg = System.Drawing.Image.FromFile(displayedImg);
// Get the thumbnail 100 X 100 px
myimg = myimg.GetThumbnailImage(1280, 825, null, IntPtr.Zero);
// Save the new thumbnail image
myimg.Save(displayedImgThumb + imgFileName, myimg.RawFormat);