ImageMagik / UNIX: How to recursively process a nested photo directory?

Question: How do I recursively process, using Imagemagik (convert), a nested photo catalog?

I have the following directory structure:

/
..2008/
....a.jpg
....b.jpg
..2009/
.....c.jpg

And I want to run the following ImageMagik command for each file, clear / resize the images, and then save the result as the same file name as the original file. Basically, I want to replace the original file with the generated modified file.

// from unix command line    
convert FILENAME.jpg -resize 100x100 -sharpen 1.5 -strip -profile "*" -sampling-factor 4x1 -quality 80 FILENAME.jpg;
+3
source share
1 answer

Try to use find -exec. For instance:

find dirname -type f -iname "*.jpg" -exec convert \{\} -resize 100x100 -sharpen 1.5 -strip -profile "*" -sampling-factor 4x1 -quality 80 \{\} \;

, . , . ?

+6

Source: https://habr.com/ru/post/1753638/


All Articles