Last post Jan 25, 2008 12:04 PM by comp138
Jan 25, 2008 05:05 AM|k2_santhosh|LINK
I have a photograph submission facility to the user. User will submit a photograph while filling the form. The photograph sizes are varying. But we are allowing only gif\Png\Jpg etc. What i wanted is to show the A4 size of that photograph on the portal.So,
I wanted to know as how do i shrink the photograph to that size. Currently, i have set the width and height properties for the image control which is making the page to slow as the size of the photograph and the image properties are mismatching for many photographs.
Hope it is clear!
Jan 25, 2008 12:03 PM|Jaspreetd|LINK
I thing you will need some third party component to do that for you. As you know you can show the image in desired size by shrinking it using image height and width property, but you cannot shrink the file size that gets downloaded to teh client browser
using this technique. You need some thumb nail creator or image resizer compoment to which you will provide the uploaded image file to resize it physically to fit you desire dimension in terms of resolution.
Jan 25, 2008 12:04 PM|comp138|LINK
Boss you can you Getthumbnail Mehtod, any how i dont know at what extent you want freez the size , any how this code may help you.
public static void LoadThumbnail(String path, PictureBox box)
// Load image file <path> into picturebox <box>
Image image = Bitmap.FromFile(path);
Bitmap thumb = new Bitmap(box.Width, box.Height);
Graphics gr = Graphics.FromImage(thumb);
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low;
gr.DrawImage(image, new Rectangle(0, 0, thumb.Width, thumb.Height));
box.Image = thumb;