BlankThanks for everybody's input.
This is how I have done it. The only thing I have not done, is to reduce the colour depth of the thumbnail.Because of this the physical size of the thumbnail is quite large. Any ideas????
private void btnResize_Click(object sender, System.EventArgs e)
{
String[] files = Directory.GetFiles("c:\\images");
foreach (string imagefile in files)
{
FileInfo FileProps =new FileInfo(imagefile);
string filename = FileProps.Name;
string fileextension = FileProps.Extension;
string [] Split = filename.Split(new Char [] {'.'}); //removes all character after and including (.)
filename = Split[0].ToString();
if (fileextension.ToLower() == ".jpg")
{
Image OriginalImage;
OriginalImage= System.Drawing.Image.FromFile(imagefile);
Image thumbnailImage;
thumbnailImage = OriginalImage.GetThumbnailImage(150, 113, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
thumbnailImage.Save("c:\\images\\" + filename + "t.jpg");
}
}
}
public bool ThumbnailCallback()
{
return true;
}
Hi
How do you resize a jpg file. I want to open a file (c:\abc.jpg 800 x 600) and resize it as 120 x 100, I then want to save it as c:\abc_t.jpg.
Thanks
Slasher