Advertisement
karstenw

HEIC to PNG

Jun 9th, 2025
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 0 0
  1. #!/bin/bash
  2. # Script: heic_to_png
  3.  
  4. if [ -z "$1" ]; then
  5.     TARGET_DIR="$(pwd)"
  6. else
  7.     TARGET_DIR="$1"
  8. fi
  9.  
  10. cd "$TARGET_DIR" || { echo "Cannot change into $TARGET_DIR"; exit 1; }
  11.  
  12. for i in *.heic *.HEIC; do
  13.     [ -f "$i" ] || continue
  14.     echo "Converting $i..."
  15.     heif-convert -q 100 "$i" "${i%.*}.png"
  16.     exiftool -tagsfromfile "$i" -all:all "${i%.*}.png"
  17. done
  18.  
  19. echo "conversion done."
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement