Skip to content

Instantly share code, notes, and snippets.

@knugie
Last active December 4, 2023 06:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save knugie/881f581342347da17cf74fb94be55c7e to your computer and use it in GitHub Desktop.
Save knugie/881f581342347da17cf74fb94be55c7e to your computer and use it in GitHub Desktop.
resize and optimize JPEG images to box-fit 2048x2048 pixels with 80% JPEG quality
#! /usr/bin/env bash
# brew install imagemagick
# brew install jpegoptim
mkdir 2048
for image in *.[jJ][pP][eE]?[gG]; do
convert $image -resize 2048x2048\> ./2048/$image
jpegoptim --strip-all -q --max=80 ./2048/$image
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment