Batch conversion of jpg files to png

Make use of bash substring removal

$ for i in *.jpg; do j=${i%.jpg}.png; convert $i $j; done

This - ${i%.jpg} strips the trailing “.jpg” substring from variable i

Need more? Advanced Bash-Scripting Guide

Leave a Reply