Архив рубрики: mogrify

mogrify resize compress and examples of find

many examples

Delete files by dir:

find path ./*/big_kartochka -print
find . -path ./*/big_kartochka -exec rm -rfv {} +

Find by:

find . -maxdepth 4 -iname "*original.jpg" ! -iname "*original.jpeg" ! -iname "*original.png"  -print -exec mogrify -resize 1280 {} \;
find \( -name '*.JPG' -o -name '*.jpg' -o -name '*.jpeg' -o -name '*.JPEG' \) -print -exec mogrify -compress JPEG -quality 80 {} \;
find ./*/original \( -name '*.JPG' -o -name '*.jpg' -o -name '*.jpeg' -o -name '*.JPEG' -o -name '*.png' -o -name '*.PNG' \) -print -exec mogrify -resize 1280 {} \;

Use the prune switch, for example if you want to exclude the misc directory just add a -path ./misc -prune -o to your find command:

find .-path ./misc -prune -o -name '*.txt'-print

Here is an example with multiple directories:

find .-type d \( -path dir1 -o -path dir2 -o -path dir3 \) -prune -o -print

Here we exclude dir1, dir2 and dir3, since in find expressions it is an action, that acts on the criteria -path dir1 -o -path dir2 -o -path dir3 (if dir1 or dir2 or dir3), ANDed with type -d. Further action is -o print, just print.

find ./*/a -name '*.jpg' -print
find -name "*.jpg" -print -exec mogrify -compress JPEG -quality 80 {} \;
find -name "*.jpg" -print -exec mogrify -compress JPEG {} \;
find -name "*.jpg" -print -exec mogrify -resize 320 -quality 75 {} \;
cd /Users/fred/tmp1
mogrify -path /Users/fred/cyclops2/ -format "_Resized.jpg" -resize 50% *.png
cd /Users/fred/tmp2
filelist=$(ls)
for file in $filelist; do
mv "$file" "$(echo "$file" | sed 's/._/_/g' )"
done
mogrify -resize 35%
cd fullsize
mogrify -resize 400x238 *.png
cd thumbs
mogrify -resize 288x171 *.png
cd $DIR
&& (
mogrify -resize 1024x768 *.JPG;
mogrify -auto-orient *.JPG
)
mogrify -density 200 -units PixelsPerInch *.png