← 返回命令列表

Linux command

imagemagick 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Convert image format

magick [input.png] [output.jpg]

Resize image

magick [input.jpg] -resize [800x600] [output.jpg]

Create thumbnail

magick [input.jpg] -thumbnail [150x150^] -gravity center -extent [150x150] [thumb.jpg]

Add text watermark

magick [input.jpg] -gravity south -annotate +0+10 "[Copyright]" [output.jpg]

Combine images horizontally

magick [a.jpg] [b.jpg] +append [combined.jpg]

Create GIF from images

magick -delay [100] [*.png] [animation.gif]

Identify image info

magick identify [image.jpg]

Batch convert all PNGs to JPEGs

magick mogrify -format jpg [*.png]

说明

ImageMagick is a suite of tools for image manipulation. It can convert, resize, crop, rotate, combine, and apply effects to images in over 200 formats. Key tools: magick (transform, replaces convert in v7), identify (info), mogrify (in-place edit), composite (combine), montage (collage). In v7, all subcommands are invoked via `magick` (e.g., `magick identify`, `magick mogrify`).

参数

-resize _geometry_
Resize image.
-crop _geometry_
Crop image.
-rotate _degrees_
Rotate image.
-quality _value_
Compression quality (JPEG: 1-100, PNG: 0-9 for zlib compression level).
-gravity _type_
Anchor point for operations.
-annotate _geometry_ _text_
Add text annotation.
-blur _radius_
Apply blur.
-sharpen _radius_
Sharpen image.
-colorspace _type_
Convert colorspace.
-density _value_
Set resolution (DPI).
-strip
Remove all metadata and profiles from image.
-format _type_
Set the output image format.

FAQ

What is the imagemagick command used for?

ImageMagick is a suite of tools for image manipulation. It can convert, resize, crop, rotate, combine, and apply effects to images in over 200 formats. Key tools: magick (transform, replaces convert in v7), identify (info), mogrify (in-place edit), composite (combine), montage (collage). In v7, all subcommands are invoked via `magick` (e.g., `magick identify`, `magick mogrify`).

How do I run a basic imagemagick example?

Run `magick [input.png] [output.jpg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -resize _geometry_ do in imagemagick?

Resize image.