By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,315 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,315 IT Pros & Developers. It's quick & easy.

Resize Image!!

P: n/a
Hi all,

I am trying resize an image using the following code.

//resize image
System.Drawing.Image ImageUpload =
System.Drawing.Image.FromFile(String.Concat(Server .MapPath(FilePath),ImageName));

// create the actual thumbnail image
System.Drawing.Image ThumbnailImage =
ImageUpload.GetThumbnailImage(250,ImageUpload.Heig ht * 250 /
ImageUpload.Width, new
System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback),
IntPtr.Zero);
ThumbnailImage.Save(ImageName)); //ie: test.jpg

However i keep getting this error:
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Any one have any ideas?
Cheers,
Adam
Apr 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DWS
Adam
What line is error?

Thanks
DWS
"Adam J Knight" wrote:
Hi all,

I am trying resize an image using the following code.

//resize image
System.Drawing.Image ImageUpload =
System.Drawing.Image.FromFile(String.Concat(Server .MapPath(FilePath),ImageName));

// create the actual thumbnail image
System.Drawing.Image ThumbnailImage =
ImageUpload.GetThumbnailImage(250,ImageUpload.Heig ht * 250 /
ImageUpload.Width, new
System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback),
IntPtr.Zero);
ThumbnailImage.Save(ImageName)); //ie: test.jpg

However i keep getting this error:
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Any one have any ideas?
Cheers,
Adam

Apr 7 '06 #2

P: n/a
Take a look at this...
http://www.howtodothings.com/compute...humbnails.html

I seem to remember having to process it from memory. If I recall correctly
the GDI+ error only occurred if I tried to process an image from disk that I
had only just saved, which is why I decided to process from memory instead.

Pete
Apr 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.