I recently needed to convert Canon *.CR2 RAW files to JPEG. What I did not know is that a Mac brings all you need preinstalled in form of a CLI tool called sips
.
for i in *.CR2; do
sips -s format jpeg $i --out "${i%.*}.jpg"
done
Also: man sips
works just fine for more information.
Source: Coderwall