How to Convert Image to TIFF Using ImageMagick?
This article provides a quick, practical guide on how to use the
ImageMagick convert command to transform various image file
formats into TIFF format. You will learn the basic command structure,
how to handle batch conversions, and how to apply specific compression
methods to optimize your output files. Whether you are working with
single images or large batches, these commands will help you streamline
your image processing workflow directly from the terminal.
The Basic Convert Command
To convert a single image (such as a JPEG or PNG) into a TIFF file,
you use the standard convert syntax by specifying the input
file name followed by the desired output name with the
.tiff (or .tif) extension. ImageMagick
automatically detects the format from the file extension.
convert input.jpg output.tiffSpecifying TIFF Compression
TIFF files can become quite large if left uncompressed. To manage
file sizes, you can specify a compression type using the
-compress flag. Common compression options include LZW,
Zip, and JPEG.
- LZW Compression (Lossless): Ideal for graphics and drawings.
convert input.png -compress LZW output.tiff- Zip Compression (Lossless): Great for balancing file size and quality.
convert input.png -compress Zip output.tiff- JPEG Compression (Lossy): Best for photographs where a smaller file size is prioritized over perfect quality.
convert input.jpg -compress JPEG output.tiffAdjusting Image Resolution (DPI)
TIFF files are frequently used in printing, where dots per inch (DPI)
matters. You can set the resolution using the -density flag
and define the units with -units.
convert input.jpg -units PixelsPerInch -density 300 output.tiffBatch Converting Multiple Images
If you have an entire directory of images that need to be converted to TIFF, you can utilize a simple shell loop in your terminal to process them all at once.
for img in *.png; do
convert "$img" -compress LZW "${img%.png}.tiff"
doneThis loop takes every PNG file in the current folder, applies lossless LZW compression, and saves it as a TIFF file with the original filename.