Install ImageMagick
# yum Install ImageMagick imagemagick-devel
# convert-version Version:imagemagick-6.2.8 05/07/12
file: /usr/share/imagemagick-6.2.8/doc/index.html
copyright:copyright (C) 1999-2006 ImageMagick Studio LLC
You can also install PHP extensions Imagick
http://php.net/manual/en/book.imagick.php
Convert command
Convert picture format
# convert Src.jpg dst.png
Specify the image quality after processing
# convert-quality Src.jpg dst.png
Scaling
-resize widthxheight{%} {@} {!} {<}>} {^}
1, according to the wide high school big side enlarges or shrinks, the other side is treated proportionally.
# convert-resize 600x600 src.jpg dst.jpg
The 600x600 here represents 600px and can be expressed as a percentage, and the following command indicates that it will shrink to 50%, to 80%.
# convert-resize 50%x80% src.jpg dst.jpg
2, adjust the picture to a fixed size, you can add an exclamation point after the wide height!
# convert-resize 600x600! Src.jpg dst.jpg
3, fixed width or height zoom, the other side of the proportional treatment
# convert-resize Src.jpg dst.jpg
# convert-resize X400 src.jpg dst.jpg
4, use @ To specify the number of pixels in the picture.
# convert-resize "10000@" Src.jpg dst.jpg
Original size 910x1365, 81x122 after execution
5, the picture is greater than or less than a certain size zoom
# convert-resize "300x200>" Src.jpg dst.jpg
300x200> means to shrink when the picture is larger than 300x200
300x200< means to zoom in when the picture is less than 300x200