← 返回命令列表

Linux command

convert 命令

文本

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

常用示例

Convert

convert [input.png] [output.jpg]

Resize

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

Rotate

convert [input.jpg] -rotate [90] [output.jpg]

Add

convert [input.jpg] -border [10x10] -bordercolor [black] [output.jpg]

Compress

convert [input.jpg] -quality [85] [output.jpg]

说明

convert is the primary command-line interface for ImageMagick, one of the most versatile image processing tools available. It supports over 200 image formats and can perform virtually any image transformation including format conversion, resizing, rotation, cropping, color manipulation, and applying artistic effects. The tool operates by reading one or more input images, applying a series of transformations specified by command-line options, and writing the result to an output file. Multiple operations can be chained together in a single command, with operations applied in the order specified. convert is widely used in web development for generating thumbnails, in photography workflows for batch processing, and in scientific computing for image analysis. Its scriptable nature makes it ideal for automation, though complex operations can consume significant memory and CPU time. In ImageMagick 7+, the command is being replaced by the unified magick command, though convert remains available for compatibility.

参数

-resize _geometry_
Resize image (e.g., 50%, 800x600, 800x)
-rotate _degrees_
Rotate image
-crop _geometry_
Crop image
-quality _value_
Compression quality (1-100)
-scale _geometry_
Scale image (faster, lower quality)
-thumbnail _geometry_
Create thumbnail
-blur _radius_
Blur image
-sharpen _radius_
Sharpen image
-negate
Invert colors
-monochrome
Convert to black and white
-flip
Flip vertically
-flop
Flip horizontally

FAQ

What is the convert command used for?

convert is the primary command-line interface for ImageMagick, one of the most versatile image processing tools available. It supports over 200 image formats and can perform virtually any image transformation including format conversion, resizing, rotation, cropping, color manipulation, and applying artistic effects. The tool operates by reading one or more input images, applying a series of transformations specified by command-line options, and writing the result to an output file. Multiple operations can be chained together in a single command, with operations applied in the order specified. convert is widely used in web development for generating thumbnails, in photography workflows for batch processing, and in scientific computing for image analysis. Its scriptable nature makes it ideal for automation, though complex operations can consume significant memory and CPU time. In ImageMagick 7+, the command is being replaced by the unified magick command, though convert remains available for compatibility.

How do I run a basic convert example?

Run `convert [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 convert?

Resize image (e.g., 50%, 800x600, 800x)