ImageMagick is a free software that creates, edits, and synthesizes pictures. It can read, convert, and write images in many formats. Picture cutting, color substitution, application of various effects, picture rotation, composition, text, line, polygon, ellipse, curve, attach to the picture stretching rotation. Its all open source, can be free to use, copy, modify, release. It complies with the GPL license agreement. It can run on most operating systems.
Most importantly, the use of most of ImageMagick's features comes from command-line tools.
ImageMagick, GraphicsMagick commands at a glance
----------------------------------------------------------------------------
[Convert | identify | mogrify | composite | montage | compare | display | animate | import | conjure]
Convert: Transform image format and size, blur, crop, banish stains, jitter, proximity, picture pictures, add new images, generate thumbnails, etc.
Identify: Describes the format and characteristics of one or more image files.
Mogrify: According to the specified size * * * An image, blur, crop, jitter and so on. Mogrify overwrites the original image file and then writes to a different image file.
Composite: Creates a picture based on a picture or multiple picture combinations.
Montage: Create some separate feature images. Any decorative images that contain feature images, such as borders, structures, picture names, and so on.
Compare: Evaluate different pictures in arithmetic and visually * * * other makeover pictures.
Display: If you have an X server system, it can show the picture in a sequential order
Animate: Display animated pictures with X server
Import: Prints the picture file on X server or any visible window. You can capture a single window, the entire screen or a rectangular portion of any screen.
Conjure: Explains the script executed by the MSL (Magick Scripting Language).
Example One: synthetic operation (ImageMagick)
Convert-crop 300x300+0+0 -resize 200x200-colors +profile "*" 1. jpg C8>1. png
explanation of the processing process:
1, the current directory 1.jpg picture file, from the upper left corner (0,0) coordinates as the starting point, cutting a piece of 300x300 pixels.
2. Then reduce the part to 200x200 pixels.
3, then reduce the color to 100 colors.
4, +profile "*" means that the image file does not store EXIF information to reduce the volume of the picture.
5, the final generation of 1.png, saved in the current directory.
Note:-resize will try to preserve the original length-to-width ratio, so it does not necessarily generate a picture that matches the size you specify, such as if the 2.jpg size is 400x200, so if you use the command: Convert 2.jpg-resize 100x100 2.png, Then the actual size of the generated picture 2.png is 100x50.
Common parameters Use Description:
-crop width x Height + start axis + start ordinate: crop graph
-resize width x Height!: Change the size, if using an exclamation point, indicating that the visual scale is not retained, forcibly changing the size to match the given width and height, if only a width or height is given, such as "width X" or "X high" (The effect of "X high" and "width × height" is the same), The dimension is scaled proportionally to the known parameter.
-colors Number of colors: Set the number of colors used in the image, if it is generated PNG or GIF pictures should specify this parameter
-quality quality: Set JPEG image output quality, recommended to use 80, this command only for the output format is JPG, should not be omitted, the default quality is 95, the resulting picture is too large
+profile "*": Image does not store EXIF information, must be used, otherwise generate pictures too large
example two: generating thumbnails (ImageMagick command line)----------------------------------------------------------------------------
Convert-sample 80x40 input.jpg output.jpg (using a simple algorithm to generate thumbnails, fast, low-quality, suitable for generating images below 100x100)
Convert-resize 100x100 foo.jpg thumbnail.jpg (good quality)
Convert-resize %x50% foo.jpg thumbnail.jpg
Convert-resize 100x200 jpg (picture path) One- to-one JPG (the zoomed-in storage path) picture proportionally scaled
Convert-resize 100x200\! A. jpg (picture path) one-by-one. jpg (to hold the path after zooming) forces the zoom to a given width and height
example three: crop a picture (ImageMagick command line)------------------------------------------------------------------------- ---
Convert-crop (Long) x200 (h) +ten(x coordinate) +ten(y) jpg ( source picture path) one. jpg ( Store path after scaling)
example four: Rotate an image (ImageMagick command line)------------------------------------------------------------------------- ---
Convert-rotate input.jpg output.jpg
Example Five: Get file information (ImageMagick command line)-------------------------------------------------------------------- -------
Libtiff Tiffinfo Filename.tiff
Example six: Turning a picture into a black and white color
Convert-monochrome Foo.png Bar.png
Add Image Watermark processing (ImageMagick command line)
--------------------------------
Suppose you add a watermark icon named Logo.gif to the lower-right corner of the original picture (Src.jpg), and the bottom edge of the watermark is 10 pixels from the original picture, and the right edge is 5 pixels from the original picture. You can use the following command:
Convert src.jpg logo.gif-gravity southeast-geometry +5+ -composite dest.jpg
Add an English text watermark (ImageMagick command line)
-----------------------------------------------------
Convert-fill white-pointsize 24-draw "text 10,15 ' Lifesinger 2006 '" 1.png 2.png
Text coordinates in: 10x50 's position
You can specify fonts with-font, and you need to install Ghostscript support.
If you install IM, GM, do not install Ghostscript font, will default to use the Linux system font, directory is:/usr/share/fonts/default/type1/
add Chinese text watermark (ImageMagick command line)
-----------------------------------------------------
Methods for high-version ImageMagick
-------------------
Convert-font C:\ImageMagick\font\fangzheng.ttf-fill green-pointsize 40-draw "text 10,50 ' text '" D:\bagImg\21.jpg d:\bag Img\22.jpg
Parameter description:-font C:\ImageMagick\font\fangzheng.ttf is a font file that indicates Windows.
To a higher version of the ImageMagick, in addition to the Chinese text watermark is not garbled.
Imagick Picture Processing