Last active
April 9, 2022 01:03
-
-
Save DrakeRubicon/4d9f3b5396d171f593e016d44ff93b2b to your computer and use it in GitHub Desktop.
imageMagick file conversion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converts every *.fileA within a folder to a target fileB | |
magick mogrify -monitor -format fileB *.fileA | |
# Example - Converts JPGs to HEICs | |
magick mogrify -monitor -format heic *.jpg | |
# converts *.fileA recursively within folders to a target fileB | |
# -print0 prevents parsing errors on files with spaces | |
find . -name "*.fileA" -print0 | xargs -0 mogrify -monitor -format fileB | |
# Example - Converts PNGs to GIFs | |
find . -name "*.png" -print0 | xargs -0 mogrify -monitor -format gif | |
# Example - Converts all JPG and JPEG to HEIC | |
# -type f - only search for files (not directories) | |
# \( & \) - are needed for the -type f to apply to all arguments | |
# -o - logical OR operator | |
# -iname - like -name, but the match is case insensitive | |
find . -type f \( -iname \*.jpg -o -iname \*.jpeg \) -print0 | xargs -0 mogrify -monitor -format heic | |
# Example - Converts JPGs to HEICs in Parallel on all available cores | |
find . -name "*jpg" | parallel -I% --max-args 1 magick mogrify -monitor -format heic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment