OSDN Git Service

Regular updates
[twpd/master.git] / imagemagick.md
1 ---
2 title: Imagemagick
3 layout: 2017/sheet
4 intro: |
5   A quick reference for common [Imagemagick](https://www.imagemagick.org) commands and switches.
6 ---
7
8 ### Common options
9
10 | Option              | Description                     |
11 | ------------------- | ------------------------------- |
12 | `-resize 100x40`    | Resize to a dimension           |
13 | `-crop 40x30+10+10` | (width)x(height)+(x)+y          |
14 | `-crop 40x30-10-10` | (width)x(height)+(x)+y          |
15 | `-flip`             | Vertical                        |
16 | `-flop`             | Horizontal                      |
17 | `-transpose`        | Flip vertical + rotate 90deg    |
18 | `-transverse`       | Flip horizontal + rotate 270deg |
19 | `-trim`             | Trim image edges                |
20 | `-rotate 90`        | Rotate 90 degrees               |
21
22 ### Resize to fit
23
24 ```sh
25 convert input.jpg -resize 80x80^ -gravity center -extent 80x80 icon.png
26 ```
27
28 ### Convert all images to another format
29
30 ```sh
31 mogrify -format jpg -quality 85 *.png
32 ```
33
34 ### Make a pdf
35
36 ```sh
37 convert *.jpg hello.pdf
38 ```
39
40 ### References
41
42 - <http://www.noah.org/wiki/ImageMagick>
43 - <https://www.imagemagick.org/>