Page 1 of 1

Policy map settings

Posted: 2018-10-07T15:33:40-07:00
by geoland
PI have just upgraded in xubuntu to Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 with Q16 installed as well.

Processing involves large numbers of tiff and miff images - from 9mb - 80mb

I have had memory allocation warnings and failure to read tiff headers, particularly with mogrify

What are the best policy map settings to avoid memory allocation issues - currently and changed from the supplied file.
<policymap>
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<policy domain="resource" name="memory" value="1GiB"/>
<policy domain="resource" name="map" value="1GiB"/>
<policy domain="resource" name="width" value="256KP"/>
<policy domain="resource" name="height" value="256KP"/>
<policy domain="resource" name="area" value="1GP"/>
<policy domain="resource" name="disk" value="1GiB"/>

Re: Policy map settings

Posted: 2018-10-07T16:38:34-07:00
by snibgo
If you delete, or comment-out, all those settings then you won't hit any limits.

Personally, that's what I do (on my personal computer, not a server). You may prefer to be more conservative, eg allow IM to use only half your memory.

Re: Policy map settings

Posted: 2018-10-07T17:44:44-07:00
by geoland
Thanks. That's what I read but was sceptical.

Re: Policy map settings

Posted: 2018-10-07T17:47:59-07:00
by fmw42
Warning about unknown tags can be made to not show for TIFF files by adding -quiet to your commands.

Re: Policy map settings

Posted: 2018-10-07T18:40:36-07:00
by geoland
I think IM failed to process some of those .tiff files.

Interestingly, I have set no restrictions in the policy map and turned off memory allocation in my bash script and '-alpha off' fails with convert and mogrify.
mogrify -alpha off *.tiff
or
for f in `ls -v *.tiff`; do mogrify -alpha off $f; done
both throw memory allocation errors while not performing the command, which can be seen when the image alignment script reports 'treating associated alpha as unassociated alpha,

Re: Policy map settings

Posted: 2018-10-07T18:58:57-07:00
by fmw42
Have you tried just processing one file with magick. For IM 7, you need to use magick rather than convert and magick mogrify rather than mogrify. See https://imagemagick.org/script/porting.php#cli

Code: Select all

magick image.tiff -alpha off result.tiff
Note that Imagemagick is not well adapted to processing layered tiffs, but will handle multi-page TIFFs. Also see the TIFF defines at https://imagemagick.org/script/command- ... php#define.

With exceedingly large TIFF files you may need to install for BigTIFF. see https://www.awaresystems.be/imaging/tiff/bigtiff.html and http://www.simplesystems.org/libtiff/bigtiffpr.html. What is your libtiff version? You can find that from

Code: Select all

magick -list format
Look at the end of the line for TIFF.

Re: Policy map settings

Posted: 2018-10-07T22:41:28-07:00
by geoland
Unfortunately, xubuntu ships with <IM7 so all convert at the moment. No previous problems with IM until update to xubuntu 18+ so not sure why the difference. Fortunately, the mogrify step is not essential, but worth noting in view of the error messages.
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.9)
TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.9)
Playing around with policymap values, mogrify was erratic and eventually complained about memory after several files. With policymap commented out, the first or second file would be OK and the remainder throw errors.

Re: Policy map settings

Posted: 2018-10-08T09:45:09-07:00
by fmw42
So what version and date is associated with your xUbuntux? Can you post an example TIFF that fails to some free hosting service such as dropbox.com that won't change the format (or zip it first)