Table of Contents

ImageMagick

Sample

## Convert 16-bit TIFF (0-65535) to 8-bit TIFF (0-255)
convert -depth 8 input.tif output.tif
## Convert 16-bit TIFF (0-65535) to 8-bit TIFF (0-255) rescaled as Min=0 and Max=255
convert -depth 8 -auto-level input.tif output.tif
## Check image format and characteristics
identify input.tif
identify -verbose input.tif

Troubleshooting - Resources Exhausted

## identify-im6.q16: width or height exceeds limit `input.tif' @ error/cache.c/OpenPixelCache/3911.
## identify-im6.q16: cache resources exhausted `input.tif' @ error/cache.c/OpenPixelCache/4083.
sudo vi /etc/ImageMagick-6/policy.xml
======================================================
<policy domain="resource" name="memory" value="3GiB"/>
<policy domain="resource" name="map" value="6GiB"/>
<policy domain="resource" name="width" value="32KP"/>
<policy domain="resource" name="height" value="32KP"/>
<policy domain="resource" name="area" value="512MB"/>
<policy domain="resource" name="disk" value="1GiB"/>
======================================================
convert -list resource
Resource limits:
  Width: 32KP
  Height: 32KP
  List length: 18.446744EP
  Area: 512MP
  Memory: 3GiB
  Map: 6GiB
  Disk: 1GiB
  File: 768
  Thread: 2
  Throttle: 0
  Time: unlimited

References