Using the image magick feeling very powerful.
Original address: http://blog.csdn.net/newborn2012/article/details/24964577
---------
ImageMagick Document: http://www.imagemagick.org/script/command-line-options.php
Convert powerful, used to batch image amplification, reduction, cropping, rotation, merging, watermark, splicing, format conversion, etc. are very convenient, especially for the background image processing. 1. Get picture information
[plain] view plain copy $identify image.png image.png png 559x559 559x559+0+0 8-bit SRGB 467KB 0.000u 0:00.008
If you only need to get a wide height:
[plain] view plain copy $identify-format "%wx%h" image.png
2, zoom in, Zoom out-resize
[plain] view plain copy $convert image.png-resize 200x200 resize.png
can also be scaled (halved):
[plain] view plain copy $convert image.png-resize 50% resize.png
You can also zoom in multiple times (half-scaled, then magnified one more time, the effect is blurred):
[plain] view plain copy $convert image.png-resize 50%-resize 200% resize.png
3, zooming in and out-sample differs from resize in that-sample is only sampled and not interpolated, so it is most appropriate to generate thumbnails [plain] View Plain copy $convert image.png -sample 50% sample.png The effect of this process is mosaic: [ Plain] View plain copy $convert image.png -sample 10% -sample 1000% sample.png 4, crop-crop to crop a 100x100-sized picture starting at (50,50) position: [plain] View Plain Copy $convert image.png -crop 100x100+50+50 crop.png If you do not specify a location, The small picture is separated by this size, and this command generates CROP-0.PNG,CROP-1.PNG,CROP-2.PNG ... : [Plain] View plain copy $convert image.png -crop 100x100 crop.png can specify the relative position of the clipping position-gravity: [plain] View plain copy