-
-
Save confluencepoint/253e52ed308f67a62734aeac5abc6e1b to your computer and use it in GitHub Desktop.
HEIC to JPG using terminal (in macOS)
This file contains hidden or 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
# Add this to your .zshrc or .bashrc | |
# Use it by simply calling `heic2jpg pwd/picture1.heic pwd/picture2.heic pwd/picture3.heic` | |
# Only compatible with macOS. You can also change line 21 to make it compatible with something else. | |
# If you decide to delete source files, those will be in the bin, not deleted as with `rm` command. | |
# You will need imagemagick bin to convert the pictures: `brew install imagemagick` | |
heic_convert() { | |
echo "Converting $# .HEIC files to .jpg" | |
for var in "$@" | |
do | |
magick mogrify -monitor -format jpg $var | |
done | |
echo "Remove .HEIC files? [y/n]" | |
read remove_source | |
if [[ "$remove_source" == "y" ]]; then | |
for var in "$@" | |
do | |
osascript -e "tell application \"Finder\" to delete POSIX file \"${var}\"" | |
done | |
fi | |
} | |
alias heic2jpg="heic_convert" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment