JPEG-2000 convert use all available memory
Posted: 2016-06-23T01:30:47-07:00
Hello!
I have a big problem, and i couldn't find solution. I triied about 10-20 options for this, but i still can't limit the memory usage for the jp2 conversion.
About 300-400 MB is free all the time, but the conversion use all the ramaining memory in my PC, and i am afraid of the failure in my server, because there is a web application.
I use the im4java lib to process the conversions in batch mode (10-12 at one time), and i thought the memory allocation error is lib's failure, but then i tested the normal cmd line conversion.
Example:
25/85 MB tif image with 4207x6522 8-bit sRGB.
Referring to the formula [(Quantum * height * width * channel)/8] => 16 * 4207 * 6522 * 3 = 157MB * 2 /*because of the pixel clone*/ ~ 320MB
And it's fine the total memory usage is about 340MB (i think because of the windows' task manager working with 1000 not with 1024) when i convert the file into a jpeg. But when i try the jp2 it's 1,2 GB.
Same is for the bigger, 8889x15120 image, but in this case, the memory usage always the available memory - 400MB, which is in my case ~5GB, intead of the ~1,5GB. It's like the memory allocation is growing exponential, and i don't know a multiplier "magic number".
I tried:
I have a big problem, and i couldn't find solution. I triied about 10-20 options for this, but i still can't limit the memory usage for the jp2 conversion.
About 300-400 MB is free all the time, but the conversion use all the ramaining memory in my PC, and i am afraid of the failure in my server, because there is a web application.
I use the im4java lib to process the conversions in batch mode (10-12 at one time), and i thought the memory allocation error is lib's failure, but then i tested the normal cmd line conversion.
Example:
25/85 MB tif image with 4207x6522 8-bit sRGB.
Referring to the formula [(Quantum * height * width * channel)/8] => 16 * 4207 * 6522 * 3 = 157MB * 2 /*because of the pixel clone*/ ~ 320MB
And it's fine the total memory usage is about 340MB (i think because of the windows' task manager working with 1000 not with 1024) when i convert the file into a jpeg. But when i try the jp2 it's 1,2 GB.
Same is for the bigger, 8889x15120 image, but in this case, the memory usage always the available memory - 400MB, which is in my case ~5GB, intead of the ~1,5GB. It's like the memory allocation is growing exponential, and i don't know a multiplier "magic number".
I tried:
- the image magick -limit options but it's not working.
the JasPer limitations with the -define option. Example: ftp://ftp.tuwien.ac.at/graphics/ImageMa ... w/jp2.html
also tried the quality with the normal -quality (but this isn't working at all, i think because of the delegating) and the -delegate jp2:quality=50. Result: the file is smaller, but the memory usage is still the maximum.