# Convert and combine multiple images to a single PDF. convert image1.png image2.jpg image3.bmp output.pdf
# Create a GIF from a series of images with 100ms delay between them: convert image1.png image2.png image3.png -delay 10 animation.gif
# Create a favicon from several images of different sizes: convert image1.png image2.png image3.png image.ico
分页
1 2 3 4 5
# To convert an N page pdf to N images (will autonumber): convert -density 150 arch1.pdf -quality 80 'output.jpg'
# To convert an N page pdf to N images with explicit filename formatting: convert -density 150 arch1.pdf -quality 80 'output-%d.jpg'
遍历文件夹
1 2 3 4 5 6
# To resize all of the images within a directory: for file in `ls original/image/path/`; do new_path=${file%.*}; new_file=`basename$new_path`; convert $file -resize 150 converted/image/path/$new_file.png; done
functiontravelDir() { files=$(ls"$1") for file in$files do if [ -d "$1/$file" ]; then safeMk "$2/$file" travelDir "$1/$file""$2/$file" else convert2webp "$1/$file""$2" fi done }
functionhandleDir() { files=$(ls"$1") for file in$files do if [ ! -d "$1/$file" ]; then convert2webp "$1/$file""$2" fi done }