Policy map settings

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
geoland
Posts: 74
Joined: 2015-05-14T05:11:38-07:00
Authentication code: 6789

Policy map settings

Post 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"/>
Version: ImageMagick 7.0.7 (latest compiled from source) Q32 x86_64 (as of) 2018 - 04 - 31 xubuntu
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Policy map settings

Post 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.
snibgo's IM pages: im.snibgo.com
geoland
Posts: 74
Joined: 2015-05-14T05:11:38-07:00
Authentication code: 6789

Re: Policy map settings

Post by geoland »

Thanks. That's what I read but was sceptical.
Version: ImageMagick 7.0.7 (latest compiled from source) Q32 x86_64 (as of) 2018 - 04 - 31 xubuntu
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Policy map settings

Post by fmw42 »

Warning about unknown tags can be made to not show for TIFF files by adding -quiet to your commands.
geoland
Posts: 74
Joined: 2015-05-14T05:11:38-07:00
Authentication code: 6789

Re: Policy map settings

Post 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,
Version: ImageMagick 7.0.7 (latest compiled from source) Q32 x86_64 (as of) 2018 - 04 - 31 xubuntu
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Policy map settings

Post 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.
geoland
Posts: 74
Joined: 2015-05-14T05:11:38-07:00
Authentication code: 6789

Re: Policy map settings

Post 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.
Version: ImageMagick 7.0.7 (latest compiled from source) Q32 x86_64 (as of) 2018 - 04 - 31 xubuntu
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Policy map settings

Post 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)
Post Reply