使用 ImageMagick Composite 合成功能

使用合成程序將一個圖像重疊在另一個圖像上。

有關如何構造合成命令的建議,請參閱命令行處理,或參見下列的命令範例用法。

/usr/local/ImageMagick/bin/magick composite -help

範例用法

在此列出一些合成命令的範例,以說明其有用性和易用性。


首先,讓我們在玫瑰上疊加一個笑臉:

/usr/local/ImageMagick/bin/magick composite -gravity center smile.gif rose.jpg rose-over.png

或者,可以使用 Atop 創建三維效果:

/usr/local/ImageMagick/bin/magick convert -size 70x70 canvas:none -fill red -draw 'circle 35,35 10,30' red-circle.png
/usr/local/ImageMagick/bin/magick convert -size 70x70 canvas:none -draw 'circle 35,35 35,20' -negate -channel A -gaussian-blur 0x8 white-highlight.png
/usr/local/ImageMagick/bin/magick composite -compose Atop -geometry +0+0 white-highlight.png red-circle.png red-ball.png

可以在 Examples of ImageMagick Usage 的範例中找到使用合成的其他範例。

可以通過查看 SVG Alpha Compositing 了解更多關於它們和數學的信息


選項摘要

-affine matrixaffine transform matrix
-alphaon, activate, off, deactivate, set, opaque, copy, transparent, extract, background, or shape the alpha channel
-authenticate valuedecrypt image with this password
-blend geometryblend images
-blue-primary pointchromaticity blue primary point
-border geometrysurround image with a border of color
-bordercolor colorborder color
-channel typeapply option to select image channels
-colors valuepreferred number of colors in the image
-colorspace typeset image colorspace
-comment stringannotate image with comment
-compose operatorset image composite operator
-compress typeimage compression type
-debug eventsdisplay copious debugging information
-decipher filenameconvert cipher pixels to plain
-define format:optiondefine one or more image format options
-density geometryhorizontal and vertical density of the image
-depth valueimage depth
-displace geometryshift image pixels defined by a displacement map
-dissolve valuedissolve the two images a given percent
-dither methodapply error diffusion to image
-encipher filenameconvert plain pixels to cipher pixels
-encoding typetext encoding type
-endian typeendianness (MSB or LSB) of the image
-extract geometryextract area from image
-filter typeuse this filter when resizing an image
-font namerender text with this font
-geometry geometrypreferred size or location of the image
-gravity typehorizontal and vertical text placement
-green-primary pointchromaticity green primary point
-helpprint program options
-identifyidentify the format and characteristics of the image
-interlace typetype of image interlacing scheme
-interpolate methodpixel color interpolation method
-label stringassign a label to an image
-level valueadjust the level of image contrast
-limit type valuepixel cache resource limit
-log formatformat of debugging information
-monitormonitor progress
-monochrometransform image to black and white
-negatereplace each pixel with its complementary color
-page geometrysize and location of an image canvas (setting)
-pointsize valuefont point size
-profile filenameadd, delete, or apply an image profile
-quality valueJPEG/MIFF/PNG compression level
-quantize colorspacereduce image colors in this colorspace
-quietsuppress all warning messages
-red-primary pointchromaticity red primary point
-regard-warningspay attention to warning messages.
-respect-parenthesessettings remain in effect until parenthesis boundary.
-rotate degreesapply Paeth rotation to the image
-sampling-factor geometryhorizontal and vertical sampling factor
-scene valueimage scene number
-seed valueseed a new sequence of pseudo-random numbers
-set attribute valueset an image attribute
-sharpen geometrysharpen the image
-shave geometryshave pixels from the image edges
-size geometrywidth and height of image
-stegano offsethide watermark within an image
-stereo geometrycombine two image to create a stereo anaglyph
-stripstrip image of all profiles and comments
-swap indexesswap two images in the image sequence
-synchronizesynchronize image to storage device
-taintmark the image as modified
-thumbnail geometrycreate a thumbnail of the image
-tilerepeat composite operation across and down image
-transformaffine transform image
-transparent-color colortransparent color
-treedepth valuecolor tree depth
-type typeimage type
-units typethe units of image resolution
-unsharp geometrysharpen the image
-verboseprint detailed information about the image
-versionprint version information
-virtual-pixel methodaccess method for pixels outside the boundaries of the image
-watermark geometrypercent brightness and saturation of a watermark
-white-point pointchromaticity white point
-white-threshold valueforce all pixels above the threshold into white
-write filenamewrite images to this file

參考資料:

Command-line Tools: Composite @ ImageMagick

http://www.imagemagick.org/script/composite.php

新增時間 2020-02-05
最後更新 2022-02-09