Buffer size in get_image_dimensions too small
|Reported by:||seph||Owned by:||nobody|
|Severity:||Keywords:||ImageField, get_image_dimensions, buffer|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The buffer size inside django/core/files/images.py, get_image_dimensions is currently set to 1024 bytes in trunk.
This wouldn't nescessarily mean many iterations if the image can be identified through PIL without loading the entire image. But using a 32 MB TIFF will result in excessive CPU usage due to the large amounts of iterations needed to reach 32 MB (somewhere over 30.000 iterations). This effectively means the ImageField which uses get_image_dimensions cannot operate under these conditions.
Increasing this buffer from 1K to 16K would mean a lot for general performance of the ImageField.
My current workaround is moneypatching the function to override the buffer size, but some kind of fix or setting would really be appreciated.
Change History (6)
comment:1 Changed 7 years ago by
|milestone:||1.1 → 1.2|
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Design decision needed|