Last active
October 26, 2025 13:24
-
-
Save gregsonar/000fc6ac54a87023375d0ab685a40f8e to your computer and use it in GitHub Desktop.
.TIF to .jpg bulk image conversion
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
| # output folder: | |
| mkdir -p output | |
| # conversion using GNU parallel | |
| find . -type f -iname "*.tif" -print0 | | |
| parallel -0 --bar -j "$(nproc)" ' | |
| outfile="output/{= s:^\./::; s:\.[^.]*$:.jpg: =}" | |
| mkdir -p "$(dirname "$outfile")" | |
| convert {} "$outfile" || echo "ERROR: {}" >> failed.log | |
| ' | |
| # simplified, with the path precessing inside the shell, not inside the parallel process itself | |
| find . -type f -iname "*.tif" -print0 | | |
| parallel -0 --bar -j "$(nproc)" ' | |
| relpath={}; | |
| relpath=${relpath#./}; | |
| outfile="output5/${relpath%.*}.jpg"; | |
| mkdir -p "$(dirname "$outfile")"; | |
| convert {} "$outfile" || echo "ERROR: {}" >> failed.log | |
| ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment