Created
November 25, 2025 03:19
-
-
Save openly-retro/140a75e5162fe3bca9f4645cae30e332 to your computer and use it in GitHub Desktop.
Use Imagemagick to convert a HEIC image to JXL and rename based on original creation date
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
| #!/bin/bash | |
| sourcefile=$1 | |
| sourcefilenoext="${sourcefile%.*}" | |
| sourceasjxl="${sourcefilenoext}.jxl" | |
| SECONDS=0 | |
| # conversion to jxl (JPEG-XL) | |
| magick mogrify -format jxl $sourcefile -define preserve-timestamp=true | |
| # Copy EXIF tags | |
| exiftool -tagsFromFile $sourcefile $sourceasjxl | |
| # rename the JXL based on the datetime | |
| exiftool "-filename<datetimeoriginal" -d "%Y%m%d_%H%M%S.%%e" $sourceasjxl | |
| # rm $sourceasjxl | |
| rm "${sourcefilenoext}.jxl_original" | |
| duration=$SECONDS | |
| echo "Done in $((duration / 60)) minutes and $((duration % 60)) seconds." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment