linux 下命令行图片处理工具 ImageMagick

2024-06-10 12:18

本文主要是介绍linux 下命令行图片处理工具 ImageMagick,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原文链接:http://hi.baidu.com/mll82/item/6811e5473e00882710ee1ea7

ImageMagick 的主要命令如下:
注:在终端下直接输入下面命令就可以看到相应命令的用法。
1、convert

转换图像格式和大小,模糊,裁剪,驱除污点,抖动,临近,图片上画图片,加入新图片,生成缩略图等。
zhancang@ubuntu:~/images$ convert
Usage: convert [options ...] file [ [options ...] file ...] [options ...] file
Options include:
-adjoin              join images into a single multi-image file
-affine matrix       affine transform matrix
-annotate geometry text
                       annotate the image with text
-antialias           remove pixel-aliasing
-append              append an image sequence
-authenticate value decrypt image with this password
-average             average an image sequence
-background color    background color
-bias value          add bias when convolving an image
-black-threshold value
                       forces all pixels below the threshold into black
-blue-primary point chromaticity blue primary point
-blur geometry       blur the image
-border geometry     surround image with a border of color
-bordercolor color   border color
-channel type        apply option to select image channels
-charcoal radius     simulate a charcoal drawing
-chop geometry       remove pixels from the image interior
-clip                clip along the first path from the 8BIM profile
-clip-path id        clip along a named path from the 8BIM profile
-clone index         clone an image
-coalesce            merge a sequence of images
-colorize value      colorize the image with the fill color
-colors value        preferred number of colors in the image
-colorspace type     alternate image colorspace
-combine             combine a sequence of images
-comment string      annotate image with comment
-compose operator    set image composite operator
-composite           composite image
-compress type       type of pixel compression when writing the image
-contrast            enhance or reduce the image contrast
-convolve coefficients
                       apply a convolution kernel to the image
-crop geometry       cut out a rectangular region of the image
-cycle amount        cycle the image colormap
-debug events        display copious debugging information
-define format:option
                       define one or more image format options
-deconstruct         break down an image sequence into constituent parts
-delay value         display the next image after pausing
-delete index        delete the image from the image sequence
-density geometry    horizontal and vertical density of the image
-depth value         image depth
-despeckle           reduce the speckles within an image
-display server      get image or font from this X server
-dispose method      GIF disposal method
-dither              apply Floyd/Steinberg error diffusion to image
-draw string         annotate the image with a graphic primitive
-edge radius         apply a filter to detect edges in the image
-emboss radius       emboss an image
-encoding type       text encoding type
-endian type         endianness (MSB or LSB) of the image
-enhance             apply a digital filter to enhance a noisy image
-equalize            perform histogram equalization to an image
-evaluate operator value
                       evaluate an arithmetic, relational, or logical expression
-extent geometry     set the image size
-extract geometry    extract area from image
-family name         render text with this font family
-fill color          color to use when filling a graphic primitive
-filter type         use this filter when resizing an image
-flatten             flatten a sequence of images
-flip                flip image in the vertical direction
-floodfill geometry color
                       floodfill the image with color
-flop                flop image in the horizontal direction
-font name           render text with this font
-format "string"     output formatted image characteristics
-frame geometry      surround image with an ornamental border
-fuzz distance       colors within this distance are considered equal
-fx expression       apply mathematical expression to an image channel(s)
-gamma value         level of gamma correction
-gaussian geometry   gaussian blur an image
-geometry geometry   perferred size or location of the image
-green-primary point chromaticity green primary point
-gravity type        horizontal and vertical text placement
-help                print program options
-implode amount      implode image pixels about the center
-insert index        insert last image into the image sequence
-intent type         type of rendering intent when managing the image color
-interlace type      type of image interlacing scheme
-label name          assign a label to an image
-lat geometry        local adaptive thresholding
-level value         adjust the level of image contrast
-limit type value    pixel cache resource limit
-log format          format of debugging information
-loop iterations     add Netscape loop extension to your GIF animation
-map filename        transform image colors to match this set of colors
-mask filename       set the image clip mask
-matte               store matte channel if the image has one
-mattecolor color    frame color
-median radius       apply a median filter to the image
-modulate value      vary the brightness, saturation, and hue
-monitor             monitor progress
-monochrome          transform image to black and white
-morph value         morph an image sequence
-mosaic              create a mosaic from an image sequence
-motion-blur geometry
                       simulate motion blur
-negate              replace every pixel with its complementary color 
-noise radius        add or reduce noise in an image
-normalize           transform image to span the full range of colors
-opaque color        change this color to the fill color
-ordered-dither NxN
                       ordered dither the image
-orient type         image orientation
-page geometry       size and location of an image canvas (setting)
-paint radius        simulate an oil painting
-ping                efficiently determine image attributes
-pointsize value     font point size
-posterize levels    reduce the image to a limited number of color levels
-preview type        image preview type
-profile filename    add, delete, or apply an image profile
-quality value       JPEG/MIFF/PNG compression level
-quiet               suppress all error or warning messages
-radial-blur angle   radial blur the image
-raise value         lighten/darken image edges to create a 3-D effect
-random-threshold low,high
                       random threshold the image
-region geometry     apply options to a portion of the image
-raise value         lighten/darken image edges to create a 3-D effect
-red-primary point   chromaticity red primary point
-render              render vector graphics
-repage geometry     size and location of an image canvas
-resample geometry   change the resolution of an image
-resize geometry     resize the image
-roll geometry       roll an image vertically or horizontally
-rotate degrees      apply Paeth rotation to the image
-sample geometry     scale image with pixel sampling
-sampling-factor geometry
                       horizontal and vertical sampling factor
-scale geometry      scale the image
-scene value         image scene number
-seed value          pseudo-random number generator seed value
-segment values      segment an image
-separate            separate an image channel into a grayscale image
-sepia-tone threshold
                       simulate a sepia-toned photo
-set attribute value set an image attribute
-shade degrees       shade the image using a distant light source
-shadow geometry     simulate an image shadow
-sharpen geometry    sharpen the image
-shave geometry      shave pixels from the image edges
-shear geometry      slide one edge of the image along the X or Y axis
-sigmodial-contrast geometry
                       lightness rescaling using sigmoidal contrast enhancement
-size geometry       width and height of image
-solarize threshold negate all pixels above the threshold level
-splice geometry     splice the background color into the image
-spread amount       displace image pixels by a random amount
-strip               strip image of all profiles and comments
-stroke color        graphic primitive stroke color
-strokewidth value   graphic primitive stroke width
-stretch type        render text with this font stretch
-style type          render text with this font style
-support factor      resize support: > 1.0 is blurry, < 1.0 is sharp
-swap indexes        swap two images in the image sequence
-swirl degrees       swirl image pixels about the center
-texture filename    name of texture to tile onto the image background
-threshold value     threshold the image
-thumbnail geometry create a thumbnail of the image
-tile filename       tile image when filling a graphic primitive
-tint value          tint the image with the fill color
-transform           affine transform image
-transparent color   make this color transparent within the image
-treedepth value     color tree depth
-trim                trim image edges
-type type           image type
-undercolor color    annotation bounding box color
-units type          the units of image resolution
-unsharp geometry    sharpen the image
-verbose             print detailed information about the image
-version             print version information
-view                FlashPix viewing transforms
-virtual-pixel method
                       virtual pixel access method
-wave geometry       alter an image along a sine wave
-weight type         render text with this font weight
-white-point point   chromaticity white point
-white-threshold value
                       forces all pixels above the threshold into white
-write filename      write images to this file

By default, the image format of `file' is determined by its magic
number. To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps). Specify 'file' as
'-' for standard input or output.

2、identify
描述一个或较多图像文件的格式和特性。

3、mogrify
按规定尺寸制作一个图像,模糊,裁剪,抖动等。Mogrify改写最初的图像文件然后写到一个不同的图像文件。

4、composite
根据一个图片或多个图片组合生成图片。
zhancang@ubuntu:~/images$ composite
Usage: composite [options ...] image [options ...] composite [ [options ...] mask ] [options ...] composite
Options include:
-affine matrix       affine transform matrix
-authenticate value decrypt image with this password
-blend geometry      blend images
-blue-primary point chromaticity blue primary point
-channel type        apply option to select image channels
-colors value        preferred number of colors in the image
-colorspace type     alternate image colorspace
-comment string      annotate image with comment
-compose operator    composite operator
-compress type       type of pixel compression when writing the image
-debug events        display copious debugging information
-define format:option
                       define one or more image format options
-density geometry    horizontal and vertical density of the image
-depth value         image depth
-displace geometry   shift image pixels defined by a displacement map
-display server      get image or font from this X server
-dispose method      GIF disposal method
-dissolve value      dissolve the two images a given percent
-dither              apply Floyd/Steinberg error diffusion to image
-encoding type       text encoding type
-endian type         endianness (MSB or LSB) of the image
-extract geometry    extract area from image
-filter type         use this filter when resizing an image
-font name           render text with this font
-geometry geometry   location of the composite image
-gravity type        which direction to gravitate towards
-green-primary point chromaticity green primary point
-help                print program options
-interlace type      type of image interlacing scheme
-label name          assign a label to an image
-limit type value    pixel cache resource limit
-log format          format of debugging information
-matte               store matte channel if the image has one
-monitor             monitor progress
-monochrome          transform image to black and white
-negate              replace every pixel with its complementary color 
-page geometry       size and location of an image canvas (setting)
-profile filename    add ICM or IPTC information profile to image
-quality value       JPEG/MIFF/PNG compression level
-quiet               suppress all error or warning messages
-red-primary point   chromaticity red primary point
-rotate degrees      apply Paeth rotation to the image
-repage geometry     size and location of an image canvas (operator)
-resize geometry     resize the image
-sampling-factor geometry
                       horizontal and vertical sampling factor
-scene value         image scene number
-sharpen geometry    sharpen the image
-size geometry       width and height of image
-stegano offset      hide watermark within an image
-stereo              combine two image to create a stereo anaglyph
-strip               strip image of all profiles and comments
-support factor      resize support: > 1.0 is blurry, < 1.0 is sharp
-thumbnail geometry create a thumbnail of the image
-tile                repeat composite operation across and down image
-transform           affine transform image
-treedepth value     color tree depth
-type type           image type
-units type          the units of image resolution
-unsharp geometry    sharpen the image
-verbose             print detailed information about the image
-version             print version information
-virtual-pixel method
                       virtual pixel access method
-watermark geometry percent brightness and saturation of a watermark
-white-point point   chromaticity white point
-write filename      write images to this file

5、montage
创建一些分开的要素图像。在含有要素图像任意的装饰图片,如边框、结构、图片名称等。 

6、compare
在算术上和视觉上评估不同的图片及其它的改造图片。

7、display
如果你拥有一个X server的系统,它可以按次序的显示图片
Usage: display

8、animate
利用X server显示动画图片
Usage: animate /home/zhancang/images/imagename.gif

9、import
在X server或任何可见的窗口上输出图片文件。 你可以捕获单一窗口,整个的荧屏或任何荧屏的矩形部分。(文件名和格式可以自定义!)
Usage: import imagemane.gif
For example: import windows.gif

10、conjure
解释执行 MSL (Magick Scripting Language) 写的脚本。(对于一般人来说,这个命令用处不大。)

这篇关于linux 下命令行图片处理工具 ImageMagick的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1048142

相关文章

Linux中SSH服务配置的全面指南

《Linux中SSH服务配置的全面指南》作为网络安全工程师,SSH(SecureShell)服务的安全配置是我们日常工作中不可忽视的重要环节,本文将从基础配置到高级安全加固,全面解析SSH服务的各项参... 目录概述基础配置详解端口与监听设置主机密钥配置认证机制强化禁用密码认证禁止root直接登录实现双因素

sqlite3 命令行工具使用指南

《sqlite3命令行工具使用指南》本文系统介绍sqlite3CLI的启动、数据库操作、元数据查询、数据导入导出及输出格式化命令,涵盖文件管理、备份恢复、性能统计等实用功能,并说明命令分类、SQL语... 目录一、启动与退出二、数据库与文件操作三、元数据查询四、数据操作与导入导出五、查询输出格式化六、实用功

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

Linux如何快速检查服务器的硬件配置和性能指标

《Linux如何快速检查服务器的硬件配置和性能指标》在运维和开发工作中,我们经常需要快速检查Linux服务器的硬件配置和性能指标,本文将以CentOS为例,介绍如何通过命令行快速获取这些关键信息,... 目录引言一、查询CPU核心数编程(几C?)1. 使用 nproc(最简单)2. 使用 lscpu(详细信

利用Python脚本实现批量将图片转换为WebP格式

《利用Python脚本实现批量将图片转换为WebP格式》Python语言的简洁语法和库支持使其成为图像处理的理想选择,本文将介绍如何利用Python实现批量将图片转换为WebP格式的脚本,WebP作为... 目录简介1. python在图像处理中的应用2. WebP格式的原理和优势2.1 WebP格式与传统

linux重启命令有哪些? 7个实用的Linux系统重启命令汇总

《linux重启命令有哪些?7个实用的Linux系统重启命令汇总》Linux系统提供了多种重启命令,常用的包括shutdown-r、reboot、init6等,不同命令适用于不同场景,本文将详细... 在管理和维护 linux 服务器时,完成系统更新、故障排查或日常维护后,重启系统往往是必不可少的步骤。本文

基于 HTML5 Canvas 实现图片旋转与下载功能(完整代码展示)

《基于HTML5Canvas实现图片旋转与下载功能(完整代码展示)》本文将深入剖析一段基于HTML5Canvas的代码,该代码实现了图片的旋转(90度和180度)以及旋转后图片的下载... 目录一、引言二、html 结构分析三、css 样式分析四、JavaScript 功能实现一、引言在 Web 开发中,

基于Python开发Windows屏幕控制工具

《基于Python开发Windows屏幕控制工具》在数字化办公时代,屏幕管理已成为提升工作效率和保护眼睛健康的重要环节,本文将分享一个基于Python和PySide6开发的Windows屏幕控制工具,... 目录概述功能亮点界面展示实现步骤详解1. 环境准备2. 亮度控制模块3. 息屏功能实现4. 息屏时间

Python如何去除图片干扰代码示例

《Python如何去除图片干扰代码示例》图片降噪是一个广泛应用于图像处理的技术,可以提高图像质量和相关应用的效果,:本文主要介绍Python如何去除图片干扰的相关资料,文中通过代码介绍的非常详细,... 目录一、噪声去除1. 高斯噪声(像素值正态分布扰动)2. 椒盐噪声(随机黑白像素点)3. 复杂噪声(如伪

Python中图片与PDF识别文本(OCR)的全面指南

《Python中图片与PDF识别文本(OCR)的全面指南》在数据爆炸时代,80%的企业数据以非结构化形式存在,其中PDF和图像是最主要的载体,本文将深入探索Python中OCR技术如何将这些数字纸张转... 目录一、OCR技术核心原理二、python图像识别四大工具库1. Pytesseract - 经典O