0

I have an aspx page that return image response i read the required image and size from the query string and then open it and redraw to new image with new size, it works fine with .png .bmp .jpg but when trying to load a gif image an exception is thrown.

Image img = System.Drawing.Image.FromFile(imgPath);

the resulted exception was

System.OutOfMemoryException: Out of memory. at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)

i tryied

Image img = new Bitmap(imgPath);

the resulted exception was

System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(String filename)

this happens only with gif images and i tried many working gif image files the images are not corrupted they work fine on windows explorer and viewer and was saved using paint

i also tried small gif images( ~= 1k), the problem still found

i tried a windows application and no exceptions found it worked fine the exceptions appears only on the asp.net

what is the problem?

ahmedsafan86
  • 1,776
  • 1
  • 26
  • 49
  • Answers of this question may help: http://stackoverflow.com/questions/1108607/out-of-memory-exception-on-system-drawing-image-fromfile – mshsayem Dec 08 '12 at 09:20
  • NO the image is not corrupted or not supported i mentioned that the problem is only on the web application not on the windows. on windows i load the same image without problems but on web there is problem – ahmedsafan86 Dec 08 '12 at 18:01

0 Answers0