138 lines
No EOL
5.2 KiB
Markdown
138 lines
No EOL
5.2 KiB
Markdown
---
|
||
obj: application
|
||
website: https://imagemagick.org
|
||
repo: https://github.com/imagemagick/imagemagick
|
||
---
|
||
|
||
# ImageMagick
|
||
ImageMagick is a collection of command-line tools that can be used to modify and manipulate images. While many people are used to using graphical user interfaces (GUIs) like [Gimp](images/GIMP.md) or Photoshop to edit images individually, these tools may not always be practical. For instance, if you need to process an image dynamically from a web script or apply the same operations to multiple images, or if you need to repeat a specific operation on the same or different images at different times, using a command-line utility like ImageMagick may be more efficient.
|
||
|
||
## Usage
|
||
```shell
|
||
magick tool [ {option} | {image} ... ] {output_image}
|
||
|
||
magick convert [image] [option]... [output]
|
||
```
|
||
|
||
You can manipulate the image with a chain of options which get executed one by one resulting in a final output image.
|
||
|
||
### Options
|
||
#### `-background color`
|
||
This option sets a background color
|
||
|
||
#### `-black-threshold value{%}`
|
||
Force to black all pixels below the threshold while leaving all pixels at or above the threshold unchanged.
|
||
|
||
The threshold value can be given as a percentage or as an absolute integer value.
|
||
|
||
#### `-blend geometry`
|
||
Blend an image into another by the given absolute value or percent.
|
||
|
||
Blend will average the images together ('plus') according to the percentages given and each pixels transparency. If only a single percentage value is given it sets the weight of the composite or 'source' image, while the background image is weighted by the exact opposite amount. That is a `-blend 30%` merges 30% of the 'source' image with 70% of the 'destination' image. Thus it is equivalent to `-blend 30x70%`.
|
||
|
||
#### `-blur radius`
|
||
Convolve the image with a Gaussian or normal distribution using the given Sigma value.
|
||
|
||
#### `-border geometry`
|
||
Surround the image with a border of color.
|
||
|
||
#### `-bordercolor color`
|
||
Set the border color.
|
||
|
||
#### `-borderwidth geometry`
|
||
Set the border width.
|
||
|
||
#### `-brightness-contrast brightness{xcontrast}{%}`
|
||
Brightness and Contrast values apply changes to the input image. They are not absolute settings. A brightness or contrast value of zero means no change. The range of values is -100 to +100 on each. Positive values increase the brightness or contrast and negative values decrease the brightness or contrast. To control only contrast, set the brightness=0. To control only brightness, set contrast=0 or just leave it off.
|
||
|
||
#### `-channel type`
|
||
Specify those image color channels to which subsequent operators are limited.
|
||
|
||
The channels above can also be specified as a comma-separated list or can be abbreviated as a concatenation of the letters 'R', 'G', 'B', 'A', 'O', 'C', 'M', 'Y', 'K'.
|
||
|
||
#### `-chop geometry`
|
||
Remove pixels from the interior of an image.
|
||
|
||
#### `-colorize value`
|
||
Colorize the image by an amount specified by value using the color specified by the most recent `-fill` setting.
|
||
|
||
Specify the amount of colorization as a percentage. Separate colorization values can be applied to the red, green, and blue channels of the image with a comma-delimited list of colorization values (e.g., `-colorize 0,0,50`).
|
||
|
||
#### `-composite`
|
||
Take the first image 'destination' and overlay the second 'source' image. The location of the 'source' or 'overlay' image is controlled according to `-gravity`, and `-geometry` settings.
|
||
|
||
#### `-contrast`
|
||
Enhance or reduce the image contrast.
|
||
|
||
#### `-copy geometry offset`
|
||
Copy pixels from one area of an image to another.
|
||
|
||
#### `-crop geometry{@}{!}`
|
||
Cut out one or more rectangular regions of the image.
|
||
|
||
#### `-draw string`
|
||
Annotate an image with one or more graphic primitives.
|
||
|
||
The shape primitives:
|
||
- `point x,y`
|
||
- `line x0,y0 x1,y1`
|
||
- `rectangle x0,y0 x1,y1`
|
||
- `roundRectangle x0,y0 x1,y1 wc,hc`
|
||
- `arc x0,y0 x1,y1 a0,a1`
|
||
- `ellipse x0,y0 rx,ry a0,a1`
|
||
- `circle x0,y0 x1,y1`
|
||
- `polyline x0,y0 ... xn,yn`
|
||
- `polygon x0,y0 ... xn,yn`
|
||
- `bezier x0,y0 ... xn,yn`
|
||
- `image operator x0,y0 w,h filename`
|
||
|
||
#### `-extract geometry`
|
||
Extract the specified area from image.
|
||
|
||
#### `-fill color`
|
||
Color to use when filling a graphic primitive.
|
||
|
||
#### `-flip`
|
||
Create a mirror image
|
||
reflect the scanlines in the vertical direction. The image will be mirrored upside-down.
|
||
|
||
#### `-flop`
|
||
Create a mirror image.
|
||
Reflect the scanlines in the horizontal direction, just like the image in a vertical mirror.
|
||
|
||
#### `-gaussian-blur radius`
|
||
Blur the image with a Gaussian operator.
|
||
|
||
#### `-geometry geometry`
|
||
Set the preferred size and location of the image.
|
||
|
||
#### `-gravity type`
|
||
Sets the current gravity suggestion for various other settings and options.
|
||
|
||
Choices include: `NorthWest`, `North`, `NorthEast`, `West`, `Center`, `East`, `SouthWest`, `South`, `SouthEast`.
|
||
|
||
#### `-negate`
|
||
Replace each pixel with its complementary color.
|
||
|
||
#### `-region geometry`
|
||
Set a region in which subsequent operations apply.
|
||
|
||
#### `-resize geometry`
|
||
Resize an image.
|
||
|
||
#### `-size width[xheight][+offset]`
|
||
Set the width and height of the image.
|
||
|
||
#### `-sort-pixels`
|
||
sorts pixels within each scanline in ascending order of intensity.
|
||
|
||
#### `-stroke color`
|
||
Color to use when stroking a graphic primitive.
|
||
|
||
#### `-strokewidth value`
|
||
Set the stroke width.
|
||
|
||
### Composite images
|
||
```shell
|
||
magick composite -geometry +100+200 overlay.png input.jpg output.jpg
|
||
``` |