當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。