I would like to batch convert all images in a subdirectory to create pyramid tifs. My windows dos .bat file is:
@ECHO OFF
convert.exe c:\image\jpg\200311032.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:c:\image\ptif\200311032.tif
PAUSE
I want to do something like
@ECHO OFF
convert.exe c:\image\jpg\*.jpg -define tiff:tile-geometry=256x256 -compress jpeg ptif:c:\image\ptif\*.tif
PAUSE
But it errors on recreating the file name for *.tif.
Pyramid Tif for all images in subdirectory
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Pyramid Tif for all images in subdirectory
The wildcards * and ? expand to a list of files, but the output files don't yet exist and so this doesn't make sense. Even if they did exist, ImageMagick couldn't match the inputs to the outputs. Fortunately there is a solution. See:
http://www.imagemagick.org/Usage/files/#save_escapes
http://www.imagemagick.org/Usage/files/#save_escapes
Re: Pyramid Tif for all images in subdirectory
Here is the answer:
::Turn of displaying the code on the screen
@echo off
:: Read all the jpg images from the directory, convert them to 256x256 tiles, compress jpeg and create the pyramid tif in another directory
for %%f in (c:\image\jpg\*.jpg) do ( convert "%%f" -define tiff:tile-geometry=256x256 -compress jpeg ptif:c:\image\ptif\%%~nf.tif )
PAUSE
Found the basis for this on http://www.rubblewebs.co.uk/imagemagick/batch.php
I'm looking at pyramid tiffs because of: http://iipimage.sourceforge.net/
::Turn of displaying the code on the screen
@echo off
:: Read all the jpg images from the directory, convert them to 256x256 tiles, compress jpeg and create the pyramid tif in another directory
for %%f in (c:\image\jpg\*.jpg) do ( convert "%%f" -define tiff:tile-geometry=256x256 -compress jpeg ptif:c:\image\ptif\%%~nf.tif )
PAUSE
Found the basis for this on http://www.rubblewebs.co.uk/imagemagick/batch.php
I'm looking at pyramid tiffs because of: http://iipimage.sourceforge.net/
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Pyramid Tif for all images in subdirectory
A great solution!
Windows users, read more about loops and extracting part of a file name:
http://technet.microsoft.com/en-us/libr ... 90909.aspx
This is also covered in the ImageMagick Usage Examples:
http://www.imagemagick.org/Usage/windows/#filenames
Windows users, read more about loops and extracting part of a file name:
http://technet.microsoft.com/en-us/libr ... 90909.aspx
This is also covered in the ImageMagick Usage Examples:
http://www.imagemagick.org/Usage/windows/#filenames