Skip to content

Instantly share code, notes, and snippets.

@paazmaya
Last active August 2, 2017 09:08
Show Gist options
  • Save paazmaya/f5916a2900be8230bed6b83967ec692e to your computer and use it in GitHub Desktop.
Save paazmaya/f5916a2900be8230bed6b83967ec692e to your computer and use it in GitHub Desktop.
Shave off (also known as cropping) sides from JPEG images with GraphicsMagick
#!/bin/bash
find . -maxdepth 2 -type f -iname '*.jpg' \
-exec sh -c '(cd $(dirname {}) && gm mogrify -shave 100x100 -auto-orient -preserve-timestamp {})' ';'
@paazmaya
Copy link
Author

paazmaya commented Aug 2, 2017

This could be the followed with:

find . -maxdepth 2 -type f -iname '*.jpg' \
-exec sh -c '(cd $(dirname {}) && jpegtran -copy all -optimize -outfile {} {})' ';'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment