14 lines
543 B
Bash
14 lines
543 B
Bash
# Dither images present in the blog, moving the existing images to filename_original.jpg
|
|
|
|
## Travel down the directory content/
|
|
|
|
find content/ \ # Find from the content directory
|
|
-maxdepth 4 \ # Maximu depth of 4 dirs
|
|
-type f \ # Find only files
|
|
-name "*.jpg" \ # Find only JPEG files
|
|
-exec \ # Execute next lines
|
|
cp {} {}.original && \ # Copy file and add .original to it's filename
|
|
convert {} -colorspace GRAY -o ordered-dither o2x2 {}\ # Dither image
|
|
jpegoptim {} -S 80 -t && \ # Optimize the jpeg file
|
|
; # Finish
|