Convert TIFFs from LZW to ZIP format in PowerShell

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
ReadyPlayerOne
Posts: 2
Joined: 2017-11-28T11:26:23-07:00
Authentication code: 1152

Convert TIFFs from LZW to ZIP format in PowerShell

Post by ReadyPlayerOne »

I'm running PowerShell script that downloads a collection of tiff files and uploads them to an image repository as a nightly process. Currently, the tiff files use LZW format, and the program that exports them doesn't give an option for their output compression in ZIP format. The image repository allows annotations to be added to tiff files, but only if they use ZIP. I've read through the Command-line processing section of the site & searched through the forums but haven't found a command for this particular operation. I'd appreciate any help anyone could offer.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Post by fmw42 »

ImageMagick command line

Code: Select all

convert image.tif -compress zip image.tif
see http://www.imagemagick.org/script/comma ... p#compress

If using ImageMagick 7, then change convert to magick.
ReadyPlayerOne
Posts: 2
Joined: 2017-11-28T11:26:23-07:00
Authentication code: 1152

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Post by ReadyPlayerOne »

fmw42 wrote: 2017-11-28T11:43:54-07:00 ImageMagick command line

Code: Select all

convert image.tif -compress zip image.tif
see http://www.imagemagick.org/script/comma ... p#compress

If using ImageMagick 7, then change convert to magick.
How would you iterate through a list of tiffs? I tried

Code: Select all

magick *.tif -compress zip *.tif
and got a blob error.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Post by GeeMack »

ReadyPlayerOne wrote: 2017-11-28T12:45:19-07:00How would you iterate through a list of tiffs? I tried

Code: Select all

magick *.tif -compress zip *.tif
and got a blob error.
The "mogrify" tool might be a better choice for that. Maybe try something like this...

Code: Select all

magick mogrify -compress zip *.tif
That will read each *.tif file in the directory, recompress it with ZIP compression, and overwrite the input with an output file of the same name.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Post by fmw42 »

How would you iterate through a list of tiffs? I tried

Code: Select all

magick *.tif -compress zip *.tif
and got a blob error.
You cannot use wildcards for both input and output with magick/convert. To process a folder of images, you need to use mogrify as per GeeMack's comment.
Post Reply