本文整理汇总了Python中mapproxy.image.merge.merge_images函数的典型用法代码示例。如果您正苦于以下问题:Python merge_images函数的具体用法?Python merge_images怎么用?Python merge_images使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了merge_images函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_solid_merge
def test_solid_merge(self):
img1 = ImageSource(Image.new('RGB', (10, 10), (255, 0, 255)))
img2 = ImageSource(Image.new('RGB', (10, 10), (0, 255, 255)))
result = merge_images([img1, img2], ImageOptions(transparent=False))
img = result.as_image()
eq_(img.getpixel((0, 0)), (0, 255, 255))
开发者ID:atrawog,项目名称:mapproxy,代码行数:7,代码来源:test_image.py
示例2: test_composite_merge
def test_composite_merge(self):
# http://stackoverflow.com/questions/3374878
if not hasattr(Image, 'alpha_composite'):
raise SkipTest()
img1 = Image.new('RGBA', size=(100, 100), color=(255, 0, 0, 255))
draw = ImageDraw.Draw(img1)
draw.rectangle((33, 0, 66, 100), fill=(255, 0, 0, 128))
draw.rectangle((67, 0, 100, 100), fill=(255, 0, 0, 0))
img1 = ImageSource(img1)
img2 = Image.new('RGBA', size =(100, 100), color=(0, 255, 0, 255))
draw = ImageDraw.Draw(img2)
draw.rectangle((0, 33, 100, 66), fill=(0, 255, 0, 128))
draw.rectangle((0, 67, 100, 100), fill=(0, 255, 0, 0))
img2 = ImageSource(img2)
result = merge_images([img2, img1], ImageOptions(transparent=True))
img = result.as_image()
eq_(img.mode, 'RGBA')
assert_img_colors_eq(img, [
(1089, (0, 255, 0, 255)),
(1089, (255, 255, 255, 0)),
(1122, (0, 255, 0, 128)),
(1122, (128, 126, 0, 255)),
(1122, (255, 0, 0, 128)),
(1156, (170, 84, 0, 191)),
(3300, (255, 0, 0, 255))])
开发者ID:tjay,项目名称:mapproxy,代码行数:28,代码来源:test_image.py
示例3: test_paletted_merge
def test_paletted_merge(self):
if not hasattr(Image, 'FASTOCTREE'):
raise SkipTest()
# generate RGBA images with a transparent rectangle in the lower right
img1 = ImageSource(Image.new('RGBA', (50, 50), (0, 255, 0, 255))).as_image()
draw = ImageDraw.Draw(img1)
draw.rectangle((25, 25, 49, 49), fill=(0, 0, 0, 0))
paletted_img = quantize(img1, alpha=True)
assert img_has_transparency(paletted_img)
assert paletted_img.mode == 'P'
rgba_img = Image.new('RGBA', (50, 50), (255, 0, 0, 255))
draw = ImageDraw.Draw(rgba_img)
draw.rectangle((25, 25, 49, 49), fill=(0, 0, 0, 0))
img1 = ImageSource(paletted_img)
img2 = ImageSource(rgba_img)
# generate base image and merge the others above
img3 = ImageSource(Image.new('RGBA', (50, 50), (0, 0, 255, 255)))
result = merge_images([img3, img1, img2], ImageOptions(transparent=True))
img = result.as_image()
assert img.mode == 'RGBA'
eq_(img.getpixel((49, 49)), (0, 0, 255, 255))
eq_(img.getpixel((0, 0)), (255, 0, 0, 255))
开发者ID:tjay,项目名称:mapproxy,代码行数:27,代码来源:test_image.py
示例4: test_opacity_merge_mixed_modes
def test_opacity_merge_mixed_modes(self):
img1 = ImageSource(Image.new('RGBA', (10, 10), (255, 0, 255, 255)))
img2 = ImageSource(Image.new('RGB', (10, 10), (0, 255, 255)).convert('P'),
image_opts=ImageOptions(opacity=0.5))
result = merge_images([img1, img2], ImageOptions(transparent=True))
img = result.as_image()
eq_(img.getpixel((0, 0)), (127, 127, 255, 255))
开发者ID:atrawog,项目名称:mapproxy,代码行数:8,代码来源:test_image.py
示例5: test_merge_rgb_with_transp
def test_merge_rgb_with_transp(self):
img1 = ImageSource(Image.new('RGB', (10, 10), (255, 0, 255)))
raw = Image.new('RGB', (10, 10), (0, 255, 255))
raw.info = {'transparency': (0, 255, 255)} # make full transparent
img2 = ImageSource(raw)
result = merge_images([img1, img2], ImageOptions(transparent=False))
img = result.as_image()
eq_(img.getpixel((0, 0)), (255, 0, 255))
开发者ID:tjay,项目名称:mapproxy,代码行数:9,代码来源:test_image.py
示例6: test_merge_L
def test_merge_L(self):
img1 = ImageSource(Image.new('RGBA', (10, 10), (255, 0, 255, 255)))
img2 = ImageSource(Image.new('L', (10, 10), 100))
# img2 overlays img1
result = merge_images([img1, img2], ImageOptions(transparent=True))
img = result.as_image()
assert_img_colors_eq(img, [
(10*10, (100, 100, 100, 255)),
])
开发者ID:tjay,项目名称:mapproxy,代码行数:10,代码来源:test_image.py
示例7: test_opacity_merge_mixed_modes
def test_opacity_merge_mixed_modes(self):
img1 = ImageSource(Image.new('RGBA', (10, 10), (255, 0, 255, 255)))
img2 = ImageSource(Image.new('RGB', (10, 10), (0, 255, 255)).convert('P'),
image_opts=ImageOptions(opacity=0.5))
result = merge_images([img1, img2], ImageOptions(transparent=True))
img = result.as_image()
assert_colors_equal(img, [
(10*10, (127, 127, 255, 255)),
])
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:10,代码来源:test_image.py
示例8: test_composite_merge_opacity
def test_composite_merge_opacity(self):
if not hasattr(Image, 'alpha_composite'):
raise SkipTest()
bg = Image.new('RGBA', size=(100, 100), color=(255, 0, 255, 255))
bg = ImageSource(bg)
fg = Image.new('RGBA', size =(100, 100), color=(0, 0, 0, 0))
draw = ImageDraw.Draw(fg)
draw.rectangle((10, 10, 89, 89), fill=(0, 255, 255, 255))
fg = ImageSource(fg, image_opts=ImageOptions(opacity=0.5))
result = merge_images([bg, fg], ImageOptions(transparent=True))
img = result.as_image()
eq_(img.mode, 'RGBA')
assert_img_colors_eq(img, [
(3600, (255, 0, 255, 255)),
(6400, (128, 127, 255, 255))])
开发者ID:tjay,项目名称:mapproxy,代码行数:17,代码来源:test_image.py
注:本文中的mapproxy.image.merge.merge_images函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论