1

I am trying to convert and resize some tif files to jpgs using ImageMagick (and move them to a new folder). I've gotten the command to work on individual folders using magick mogrify -format jpg -quality 50% -density 1200 -path "V:\Temp\test2" *.tif

Now I want to apply the same logic to the entire directory, rather than just individual folders. I have used for /r "V:\Temp\Test" %f in (*.tif) do MAGICK mogrify -format jpg *.tif -quality 50% -density 1200 -path "V:\Temp\test2"

but only get the error "mogrify: unable to open image '*.tif': Invalid argument @ error/blob.c/OpenBlob/3596."

.TIFF is an installed delegate, I double checked. Uncertain what changes I can make to get it to recognize the tifs.

I have also tried for /r "V:\Temp\Test" %f in (*.TIF) do magick -format jpg -quality 50% -density 1200 "V:\Temp\Test" -path "V:\Temp\test2" *.TIF

but get the error magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/746."

Any help is greatly appreciated!

vm72
  • 13
  • 2

1 Answers1

1

The problem is you are using mogrify with *.tif inside the loop, but the loop already goes through each file, so you want to run magick convert on each single file %f.

for /r "V:\Temp\Test" %f in (*.tif) do magick "%f" -quality 50 -density 1200 "V:\Temp\test2\%~nf.jpg"

This takes each .tif file found recursively and converts it to 'jpg' with quality and density and saves it to the new folder with the same name but '.jpg' extension.

SISYPHUS
  • 189
  • 1