ConvertImageFormat

来自公开记录
跳到导航 跳到搜索

转换图片格式

From http://superuser.com/questions/71028/batch-converting-png-to-jpg-in-linux

Convert

convert source.bmp dest.jpg

Batch Convert

mogrify

mogrify -format jpg *.bmp

Shell Script

#!highlight bash
for img in *.png; do
    filename=${img%.*}
    convert "$filename.png" "$filename.jpg"
done


#!highlight bash
for i in *.png ; do convert "$i" "${i%.*}.jpg" ; done


#!highlight bash
ls -1 *.png | xargs -n 1 bash -c 'echo "$0" "${0%.*}.jpg"'