Page 1 of 1
What's the canonical way to get the RAM size of a PNG
Posted: 2014-03-22T02:10:47-07:00
by jack-mann
If I do a
I get for a 20500x8000 img.png a 500M out.bmp
So can I conclude that when imagmagick reads the img.png in it uses about 500M RAM?
Re: What's the canonical way to get the RAM size of a PNG
Posted: 2014-03-22T03:34:37-07:00
by magick
Resource requirements for a typical image is 4 x width x height. The resource can be memory or disk depending on your resource limits. Add -limit memory 2MB, for example, to limit the amount of allowed memory to 2MB. If this limit is exceeded, pixels are pushed to disk. The tradeoff is that disk access is 1000x slower than memory access. See
http://www.imagemagick.org/script/archi ... .php#cache for details.
Re: What's the canonical way to get the RAM size of a PNG
Posted: 2014-03-22T09:51:00-07:00
by glennrp
magick wrote:Resource requirements for a typical image is 4 x width x height.
It's 4 times width times height times bytes_per_sample. bytes_per_sample depends on how you built ImageMagick. It's 1 in a Q8 build, 2 in a Q16, 4, in a Q32, etc.
Re: What's the canonical way to get the RAM size of a PNG
Posted: 2014-03-22T10:44:25-07:00
by snibgo
So, in the OP's example of 20500x8000 pixels, assuming Q16, we need 8 bytes/pixels, so 1.3GB of memory.