Skip to content

Instantly share code, notes, and snippets.

@gregsonar
Last active October 26, 2025 13:24
Show Gist options
  • Select an option

  • Save gregsonar/000fc6ac54a87023375d0ab685a40f8e to your computer and use it in GitHub Desktop.

Select an option

Save gregsonar/000fc6ac54a87023375d0ab685a40f8e to your computer and use it in GitHub Desktop.
.TIF to .jpg bulk image conversion
# 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