Page 1 of 1

Convert TIFFs from LZW to ZIP format in PowerShell

Posted: 2017-11-28T11:38:54-07:00
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.

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Posted: 2017-11-28T11:43:54-07:00
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.

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Posted: 2017-11-28T12:45:19-07:00
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.

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Posted: 2017-11-28T14:02:22-07:00
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.

Re: Convert TIFFs from LZW to ZIP format in PowerShell

Posted: 2017-11-28T15:43:32-07:00
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.