用imageMagick的composite合并图片

来源:互联网 发布:封建社会 知乎 编辑:程序博客网 时间:2024/05/21 11:31

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-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
原创粉丝点击