How to determine whether an image is streamable?
Posted: 2014-06-27T02:30:53-07:00
I am developing a server for automated processing of BIG images (size of 22500x17500 is not the greatest possible)
To process them in a finite memory I need to convert them first into an RGB stream.
Stream (described as "a lightweight tool") seemed to be a perfect tool to do so, however after some benchmarking I discovered that there are formats (like JPEG2000 or even grayscale PNG without interlace) for which stream is not "lightweight" - instead it hogs a vast amount of memory:
How can I determine, whether an image can be streamed in a reasonable amount of memory, and with no temporary file use?
I can of course use: and check if stream crashes, but I look for a more elegant solution.
To process them in a finite memory I need to convert them first into an RGB stream.
Stream (described as "a lightweight tool") seemed to be a perfect tool to do so, however after some benchmarking I discovered that there are formats (like JPEG2000 or even grayscale PNG without interlace) for which stream is not "lightweight" - instead it hogs a vast amount of memory:
Code: Select all
$ /usr/bin/time -f '%M' stream -identify R602_s154_BDA_NR_10x_plainGS.png /dev/null
R602_s154_BDA_NR_10x_plainGS.png PNG 22500x17500 22500x17500+0+0 8-bit PseudoClass 256c 50.15MB 22.800u 0:17.699
12319344
I can of course use:
Code: Select all
$ ulimit -v 512000 -n 5