![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I've been working on a website and i need to resize uploaded pictures and stuff. Everything works fine with Image.fromstream method but there seems to be a simple problem, I created a simple solid blue jpg file which is 10000x10000 pixel size. Only 500 bytes as its jpg. But if i upload that file, it passes the content length limits and when my code tries to read it (Image.FromStream) it uses 100% cpu for a couple of seconds, grows memory usage and throws an outofmemory exception. It would kill the system performance but i could not find any way to read image size without reading image. So i can force some limits before reading image. Any suggestions? |
#3
| |||
| |||
|
|
AFAIK the only way to do this is to open the image as a binary stream, decode the headers, read the sizes and close the stream before reading all of it. This implies that you need to know the file header structures for all the popular image file formats. |
#4
| |||
| |||
|
|
AFAIK the only way to do this is to open the image as a binary stream, decode the headers, read the sizes and close the stream before reading all of it. This implies that you need to know the file header structures for all the popular image file formats. |
|
Reading these properties might be an option. |

#5
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |