I need to create thumbnails from multiple .png files and would like to do this using ImageMagicks convert
utility. To recursively find all files that are not thumbnails themselves, I am using the following call (split into two lines to make it readable):
find . -type f -name "*.png" -not -name "*thumb.png*" \
-exec convert {} -thumbnail 200x200 {}.thumb.png \;`
But this would of course create a file named a.png.thumb.png
when running it on a file called a.png
. How could I remove the .png
extension from the second {}
parameter passed to convert?
Best Answer
The easiest way to do this is to pass the
{}
off to a shell likesh
and have the shell do it: