composite命令可以非常方便的合并兩張圖片
因此用來進行圖像加水印、批量增加邊框等常用的變換
?
最簡單的用法為:
?
composite -gravity north src.jpg coverback.jpg des.jpg
?
其中src.jpg為前景圖片
coverback.jpg為背景圖片。
des.jpg為疊加后的結果
?
-gravity north 指疊加位置為垂直據頂部、水平居中(正北方向)
如果要求在正中間,參數為center
如果要求在右下角,參數為southeast
?
composite還提供更靈活的定位,可以使用 -geometry 配置
?
具體的composite參數表見下表
?
? -affine?matrix | affine transform matrix |
-alpha | on, activate, off, deactivate, set, opaque, copy", transparent, extract, background, or shape the alpha channel |
-authenticate?value | decrypt image with this password |
-blend?geometry | blend images |
-blue-primary?point | chromaticity blue primary point |
-border?geometry | surround image with a border of color |
-bordercolor?color | border color |
-channel?type | apply option to select image channels |
-colors?value | preferred number of colors in the image |
-colorspace?type | set image colorspace |
-comment?string | annotate image with comment |
-compose?operator | set image composite operator |
-compress?type | image compression type |
-debug?events | display copious debugging information |
-decipher?filename | convert cipher pixels to plain |
-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 |
-dissolve?value | dissolve the two images a given percent |
-dither?method | apply error diffusion to image |
-encipher?filename | convert plain pixels to cipher pixels |
-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 | preferred size or location of the image |
-gravity?type | horizontal and vertical text placement |
-green-primary?point | chromaticity green primary point |
-help | print program options |
-identify | identify the format and characteristics of the image |
-interlace?type | type of image interlacing scheme |
-interpolate?method | pixel color interpolation method |
-label?string | assign a label to an image |
-level?value | adjust the level of image contrast |
-limit?type value | pixel cache resource limit |
-log?format | format of debugging information |
-monitor | monitor progress |
-monochrome | transform image to black and white |
-negate | replace each pixel with its complementary color |
-page?geometry | size and location of an image canvas (setting) |
-pointsize?value | font point size |
-profile?filename | add, delete, or apply an image profile |
-quality?value | JPEG/MIFF/PNG compression level |
-quantize?colorspace | reduce image colors in this colorspace |
-quiet | suppress all warning messages |
-red-primary?point | chromaticity red primary point |
-regard-warnings | pay attention to warning messages. |
-respect-parentheses | settings remain in effect until parenthesis boundary. |
-rotate?degrees | apply Paeth rotation to the image |
-sampling-factorgeometry | horizontal and vertical sampling factor |
-scene?value | image scene number |
-seed?value | seed a new sequence of pseudo-random numbers |
-set?attribute value | set an image attribute |
-sharpen?geometry | sharpen the image |
-shave?geometry | shave pixels from the image edges |
-size?geometry | width and height of image |
-stegano?offset | hide watermark within an image |
-stereo?geometry | combine two image to create a stereo anaglyph |
-strip | strip image of all profiles and comments |
-swap?indexes | swap two images in the image sequence |
-synchronize | synchronize image to storage device |
-taint | mark the image as modified |
-thumbnail?geometry | create a thumbnail of the image |
-tile | repeat composite operation across and down image |
-transform | affine transform image |
-transparent-colorcolor | transparent color |
-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 | access method for pixels outside the boundaries of the image |
-watermarkgeometry | percent brightness and saturation of a watermark |
-white-point?point | chromaticity white point |
-white-thresholdvalue | force all pixels above the threshold into white |
-write?filename | write images to this file |