本文共 2943 字,大约阅读时间需要 9 分钟。
composite命令可以非常方便的合并两张图片
因此用来进行图像加水印、批量增加边框等常用的变换
最简单的用法为:
composite -gravity north src.jpg coverback.jpg des.jpg
其中src.jpg为前景图片
coverback.jpg为背景图片。
des.jpg为叠加后的结果
-gravity north 指叠加位置为垂直据顶部、水平居中(正北方向)
如果要求在正中间,参数为center
如果要求在右下角,参数为southeast
composite还提供更灵活的定位,可以使用 -geometry 配置
具体的composite参数表见下表
| affine transform matrix |
on, activate, off, deactivate, set, opaque, copy", transparent, extract, background, or shape the alpha channel | |
decrypt image with this password | |
blend images | |
chromaticity blue primary point | |
surround image with a border of color | |
border color | |
apply option to select image channels | |
preferred number of colors in the image | |
set image colorspace | |
annotate image with comment | |
set image composite operator | |
image compression type | |
display copious debugging information | |
convert cipher pixels to plain | |
define one or more image format options | |
horizontal and vertical density of the image | |
image depth | |
shift image pixels defined by a displacement map | |
dissolve the two images a given percent | |
apply error diffusion to image | |
convert plain pixels to cipher pixels | |
text encoding type | |
endianness (MSB or LSB) of the image | |
extract area from image | |
use this filter when resizing an image | |
render text with this font | |
preferred size or location of the image | |
horizontal and vertical text placement | |
chromaticity green primary point | |
print program options | |
identify the format and characteristics of the image | |
type of image interlacing scheme | |
pixel color interpolation method | |
assign a label to an image | |
adjust the level of image contrast | |
pixel cache resource limit | |
format of debugging information | |
monitor progress | |
transform image to black and white | |
replace each pixel with its complementary color | |
size and location of an image canvas (setting) | |
font point size | |
add, delete, or apply an image profile | |
JPEG/MIFF/PNG compression level | |
reduce image colors in this colorspace | |
suppress all warning messages | |
chromaticity red primary point | |
pay attention to warning messages. | |
settings remain in effect until parenthesis boundary. | |
apply Paeth rotation to the image | |
horizontal and vertical sampling factor | |
image scene number | |
seed a new sequence of pseudo-random numbers | |
set an image attribute | |
sharpen the image | |
shave pixels from the image edges | |
width and height of image | |
hide watermark within an image | |
combine two image to create a stereo anaglyph | |
strip image of all profiles and comments | |
swap two images in the image sequence | |
synchronize image to storage device | |
mark the image as modified | |
create a thumbnail of the image | |
repeat composite operation across and down image | |
affine transform image | |
transparent color | |
color tree depth | |
image type | |
the units of image resolution | |
sharpen the image | |
print detailed information about the image | |
print version information | |
access method for pixels outside the boundaries of the image | |
percent brightness and saturation of a watermark | |
chromaticity white point | |
force all pixels above the threshold into white | |
write images to this file |
转载地址:http://hjmrb.baihongyu.com/