mjc / optimizeimages.sh

Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Script to recursively optimize all images in current directory

THIS WILL OVERWRITE YOUR ORIGINAL IMAGES AND STRIP METADATA. MAKE A SNAPSHOT.

Forked from this, which is a fork of: this

This will be POSIX sh compliant as soon as I fix the semaphore implementation.

Recommend also using Pingo but it appears to be closed source.

TODO:

  • Pass shellcheck
  • Use functions to make parallelization easier
  • Don't reuse the same filenames so we can parallelize
  • Use fd instead of find so walking files is a lot faster.
  • Only use one fd or find and optimize both types of images in the same loop.
  • Use file(1) to detect file type and skip empty files.
  • Detect cpu count
  • Only spawn N processes and make sure N are always running when there are images to optimize
  • Detect if fd is installed and fall back to find if it isn't.
  • Add support for gif and other file types
  • Detect if the prerequisite programs are installed
  • Install prerequisites if they are not installed

About

Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!


Languages

Language:Shell 100.0%