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?