当前位置: 首页>>代码示例>>Python>>正文


Python Image.composite方法代码示例

本文整理汇总了Python中Image.composite方法的典型用法代码示例。如果您正苦于以下问题:Python Image.composite方法的具体用法?Python Image.composite怎么用?Python Image.composite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image的用法示例。


在下文中一共展示了Image.composite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: composite

# 需要导入模块: import Image [as 别名]
# 或者: from Image import composite [as 别名]
def composite(image1, image2, mask):
    "Create composite image by blending images using a transparency mask"

    return Image.composite(image1, image2, mask)

##
# Offset image data.
# <p>
# Returns a copy of the image where data has been offset by the given
# distances.  Data wraps around the edges.  If yoffset is omitted, it
# is assumed to be equal to xoffset.
#
# @param image Source image.
# @param xoffset The horizontal distance.
# @param yoffset The vertical distance.  If omitted, both
#    distances are set to the same value.
# @return An Image object. 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:19,代码来源:ImageChops.py

示例2: batch

# 需要导入模块: import Image [as 别名]
# 或者: from Image import composite [as 别名]
def batch(infolder, outfolder, watermark):
    mark = Image.open(watermark)
    for root, dirs, files in os.walk(infolder):
        for name in files:        try:
            im = Image.open(join(root, name))
            if im.mode != 'RGBA':
                im = im.convert('RGBA')
            layer = Image.new('RGBA', im.size, (0,0,0,0))
            position = (im.size[0]-mark.size[0], im.size[1]-mark.size[1])
            layer.paste(mark, position)
            Image.composite(layer, im, layer).save( join(outfolder, name))
        except Exception, (msg):
            print msg 
开发者ID:ActiveState,项目名称:code,代码行数:15,代码来源:recipe-576818.py

示例3: blend

# 需要导入模块: import Image [as 别名]
# 或者: from Image import composite [as 别名]
def blend(image1, image2, alpha):
    "Blend two images using a constant transparency weight"

    return Image.blend(image1, image2, alpha)

##
# Create composite using transparency mask.
# <p>
# Same as the <b>composite</b> function in the <b>Image</b> module. 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:11,代码来源:ImageChops.py

示例4: _img_rotate

# 需要导入模块: import Image [as 别名]
# 或者: from Image import composite [as 别名]
def _img_rotate(self, im, target, degree, bgcolor = '#ffffff', destformat = None):
        """
        Rotate image. The ``degree`` argument is measured clock-wise.
        """
        #rotated = im.convert('RGBA').rotate(angle=360-degree)
        alpha = Image.new('RGBA', im.size, bgcolor)
        alpha.paste(im)
        rotated = alpha.rotate(angle=360-degree, resample=Image.BILINEAR)
        
        bg = Image.new('RGBA', im.size, bgcolor)
        result = Image.composite(rotated, bg, rotated)
        self._saveimage(result, target, destformat if destformat else im.format) 
开发者ID:guohongze,项目名称:adminset,代码行数:14,代码来源:base.py


注:本文中的Image.composite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。