blog/dither.sh

14 lines
543 B
Bash
Raw Normal View History

2021-04-02 21:32:49 +02:00
# 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