Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Here is the code for my method. Maybe someone will see what I'm doing wrong. In case you aren't sure about GetThumbSize, it's simply a method that takes in the image size and the maximum thumb size and then computes an actual size to preserve the aspect ratio.

2 Answers
2

I think the problem may be the original image's encoding. IIRC, Save(stream, format) results in a call to Save(stream, encoder, params), with the encoder being taken from the format; which in your case is the original format of the image.

According to the Community Content for the Save method, some formats will not translate well into an appropriate encoder.

I would suggest you specify the encoder yourself, using some standard format like PNG.

Your suggestion lead me to try something. I had just written a method to convert the ImageFormat into a mimetype. I ran the format of the original image through this and it returned "image/gif", which was as expected because the file extension is .gif. Then I replaced the offending like with: thumb.Save(outStream, image.RawFormat); and it works. Thanks for the help.
–
JoshMay 21 '09 at 18:24