Hello.
I try to read very large BMP image from a file. The dimension of the image is 25000x19000 pixel.
following code generates the Magick::ErrorResourceLimit exception:
Add '[0]' to your filename. That reads the first image metadata and immediately returns. Without the '[0]', the image pixels are scanned but no pixel cache is allocated or traversed. Traversing a large image can be time consuming, so avoiding this step is where Ping gets its performance boost. For most image formats, a single scanline buffer is allocated to assist decoding. The BMP image pixels are stored upside down and sometimes compressed. To facilitate inverting the image and possibly decompressing, we allocate memory for the entire image instead of just a scanline. If the memory request exceeds available resources, the memory is instead allocated on disk and then memory-mapped (assuming ImageMagick resource limits are not exceeded). We could probably put in some 'if' blocks such that when the BMP image is pinged, memory allocation is skipped. We'll need to review the code to see if that is a reasonable compromise.