ImageMagick Use Guide

Source: Internet
Author: User
Tags delete key imagemagick

When you use the ImageMagick, you will find that most of the operation, you just move the keyboard at the end, so you can use the mouse point to point to.

Below, I do a simple introduction to the main functions of ImageMagick, which covers most of the people commonly used functions, if you want to fully understand its knowledge, you can look at its man handbook.

Convert

Convert as the name implies is to transform the image, it is mainly used to transform the format of the image, but also to do scaling, shearing, blur, inversion and other operations.

Format conversion

such as converting foo.jpg into foo.png:

Convert foo.jpg foo.png

If you want to convert all JPG files in the directory to GIF, we can use the powerful capabilities of the shell:

Find./-name "*.jpg"-exec convert {} {}.gif;

The translated GIF name is called *.jpg.gif, so it doesn't look natural, it doesn't matter, we can take another step:

Rename. jpg.gif. gif *.jpg.gif

Originally, I want to find in the time, with basename to get the filename without suffix, so it will not form. Jpg.gif this ugly name, but don't know why, just can't, if you know, tell me

Alternatively, you can use shell script to do the above:

For I in *.jpg

Todo

Convert $i ' basename $i. jpg '. gif

Done

We can also use mogrify to accomplish the same effect:

Mogrify-format PNG *.jpg

The above command will convert all JPG files below the directory into PNG format.

Convert can also convert more than one photo into PDF format:

Convert *.jpg foo.pdf

Size Scaling

For example, we want to make a thumbnail image of a normal size picture, we can

Convert-resize 100x100 foo.jpg thumbnail.jpg

You can also use percentages to make it more intuitive:

Convert-resize 50%x50% foo.jpg thumbnail.jpg

Convert automatically considers the ratio of the height to the width of the image when scaling the image, which means that the new image has the same height-width ratio as the original.

We can also generate thumbnails in batches:

Mogrify-sample 80x60 *.jpg

Note that this command will overwrite the original image, but you can back up your picture before you operate.

Add border

In a photo around the border, you can use-mattecolor parameters, such as a comrade sacrificed, we need to make a black frame for him portrait, you can do this:

Convert-mattecolor "#000000"-frame 60x60 yourname.jpg rememberyou.png

Where, "#000000" is the color of the border, the size of the border is 60x60

You can also add a border like this:

Convert-border 60x60-bordercolor "#000000" Yourname.jpg rememberyou.png

Add text to a picture

Convert-fill green-pointsize 40-draw ' text 10,50 ' charry.org ' foo.png bar.png

The above command in the distance from the top left corner of the picture 10x50, with green words to write down charry.org, if you want to specify a different font, you can use-font parameters.

Fuzzy

Gaussian Blur:

Convert-blur foo.jpg Foo.png

-blur parameters can also be-blur like this 80x5. The latter 5 represents the value of sigma, which is an image term, and I'm not quite sure, in short, that its value plays a key role in blurring the effect.

Flip

Flip up and down:

Convert-flip Foo.png Bar.png

Flip right and left:

Convert-flop Foo.png Bar.png

Anti-color

form a negative appearance:

Convert-negate Foo.png Bar.png

Monochrome

Turn the picture into Black-and-white color:

Convert-monochrome Foo.png Bar.png

Add noise

Convert-noise 3 Foo.png Bar.png

oil painting effect

We can use this function, a common picture, into a painting, the effect is very realistic

Convert-paint 4 Foo.png Bar.png

Rotating

Put a picture, rotate a certain angle:

Convert-rotate Foo.png Bar.png

The above 30, the right to rotate 30 degrees, if you want to rotate to the left, the degree is negative.

Charcoal Effect

Convert-charcoal 2 Foo.png Bar.png

The effect of forming a charcoal or pencil drawing.

Scattering

Hair Glass Effect:

Convert-spread Foo.png Bar.png

Vortex

Take the center of the picture as a reference and twist the picture to form the effect of the whirlpool:

Convert-swirl Foo.png Bar.png

Convex effect

To create a convex edge with-raise:

Convert-raise 5x5 foo.png Bar.png

After execution, you will see that the photo will be surrounded by a 5x5 edge, if you want a concave edge, the-raise to raise on it. In fact, the convex and concave edges do not look very much different.

Other

Other features are not commonly used, if you are interested, you can look at its online documentation

Import

Import is a screen capture component, listed below are our common features, other features, you refer to its man good.

Intercepts any rectangular area of the screen

Import Foo.png

After you enter the above command, your mouse will become a cross, at which point you just have to draw a rectangle where you want to intercept.

Intercepting a program's window

Import-pause 3-frame Foo.png

When you enter, use your mouse to click on the window you want to cut. Parameter-frame function is to tell import, screenshots when the target window outside the frame with the role of the parameter-pause is very important, you can try to remove it, contrast, you will find that the target window title bar is gray, pause is to let import a little delay, Wait for your target window to get focus, only to start screenshots, such a diagram is more natural.

To intercept a tilted window

If you want your screenshot to be cool, you can intercept a tilted window by taking the following approach:

Import-rotate 30-pause 3-frame Foo.png

Intercept the entire screen

Import-pause 3-window Root Screen.png

Note that 3 seconds have been paused and you need to switch to the screen in 3 seconds.

Display

Display should be we use the most frequent image processing software, after all, still see more

Show pictures

Display Foo.png

If you want to display multiple files, you can use the wildcard character

Display *.png

Slide

Display-delay 5 *

Show a picture every 5 seconds

Some shortcut keys

Space (spaces): Show next picture

BACKSPACE (delete key): Show previous picture

H: Flip Horizontally

V: Flip Vertically

/: Rotate 90 degrees clockwise

: Rotate 90 degrees counterclockwise

: enlarge

: Zoom Out

F7: Blurred picture

ALT s: Rotate the pixel in the middle of the picture

Ctrl S: Image save

Ctrl d: Delete pictures

Q: Exit

Other

ImageMagick also provides a rich programming interface, for example, you can use PHP to invoke it, using ImageMagick to generate code pictures, the effect is very good.

ImageMagick also has a gadget identify, which can be used to display Shishi information about a picture file, such as format, resolution, size, color depth, etc., which you could use to help you.

If you are not familiar with the command line, you can also click on the picture, you will find that through the mouse you can also complete the image editing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.