Last active
February 3, 2026 20:24
-
-
Save dacr/f6a3ba1b0318f7f8e8363fa08d36890c to your computer and use it in GitHub Desktop.
Convert iphone HEIC photo to PNG / published by https://github.com/dacr/code-examples-manager #533ad129-77f7-4664-9871-67f96c0bcea2/34c7d0f65f0f2ead35f28fe3d72fcda00203875e
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
| ## summary : Convert iphone HEIC photo to PNG | |
| ## keywords : bash, iphone, HEIC, PNG, convert | |
| ## publish : gist | |
| ## authors : David Crosson | |
| ## license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| ## id : 533ad129-77f7-4664-9871-67f96c0bcea2 | |
| ## created-on : 2025-08-24T17:39:02+02:00 | |
| ## managed-by : https://github.com/dacr/code-examples-manager | |
| ## run-with : sh $file | |
| # Enable case-insensitive globbing | |
| shopt -s nocaseglob | |
| for INPUT in *.heic; do | |
| # Extract the extension with its original case | |
| EXT="${INPUT##*.}" | |
| # Create output filename by replacing the original extension | |
| OUTPUT=$(basename "$INPUT" ".$EXT").png | |
| echo "=====================================================================" | |
| echo "-- converting '$INPUT' to '$OUTPUT'" | |
| echo "---------------------------------------------------------------------" | |
| if [ ! -f "$OUTPUT" ]; then | |
| magick "$INPUT" "$OUTPUT" && rm -f "$INPUT" | |
| else | |
| echo "Output file '$OUTPUT' already exists, skipping." | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment