I'm trying to do a batch imagemagick conversion on all tiffs in directories.
The structure of the directories looks like:
test
123
456
image.tif
256
857
anotherimage.tif
I'm trying to use find to locate all the images, and then pass those into xargs for imagemagick to convert to jp2. The output filename would be a combination of the granparent and parent directory names, so in the example above, image.tif would be converted to 123456.jp2.
I've got the find working ok, but just can't get the correct combination of imagemagick and find params to achieve what I need. Here's the find with xargs. The {grandparentdir} and {parentdir} are placeholders for the bit I'm missing!
find /var/tmp/test -type f \( -name "*.tif" -o -name "*.TIF" -o -name "*.tiff" -o -name "*.TIFF" \) -mtime -1 | xargs convert -quality 100 \var\tmp\test\{granparentdir}{parentdir}.jp2"