本文整理汇总了Python中mapproxy.test.image.create_image函数的典型用法代码示例。如果您正苦于以下问题:Python create_image函数的具体用法?Python create_image怎么用?Python create_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_image函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_merge_overlapping_coverage
def test_merge_overlapping_coverage(self):
color1 = (255, 255, 0)
color2 = (0, 255, 255)
merger = LayerMerger()
merger.add(ImageSource(Image.new('RGB', (10, 10), color1)), self.coverage1)
merger.add(ImageSource(Image.new('RGB', (10, 10), color2)), self.coverage2)
result = merger.merge(image_opts=ImageOptions(), bbox=(0, 0, 10, 10), bbox_srs=3857)
img = result.as_image()
eq_(img.mode, 'RGB')
expected = create_image((10, 10), color1, 'RGB')
draw = ImageDraw.Draw(expected)
draw.polygon([(2, 2), (7, 2), (7, 7), (2, 7)], fill=color2)
for x in range(0, 9):
for y in range(0, 9):
eq_(img.getpixel((x, y)), expected.getpixel((x, y)))
示例2: test_outside
def test_outside(self):
sub_img = create_image((50, 50), color=[100, 120, 130, 140])
img = SubImageSource(sub_img, size=(100, 100), offset=(200, 0), image_opts=ImageOptions(transparent=True)).as_image()
eq_(img.getcolors(), [(100*100, (255, 255, 255, 0))])
示例3: test_overlap_right
def test_overlap_right(self):
sub_img = create_image((50, 50), color=[100, 120, 130, 140])
img = SubImageSource(sub_img, size=(100, 100), offset=(75, 25), image_opts=ImageOptions(transparent=True)).as_image()
eq_(sorted(img.getcolors()), [(25*50, (100, 120, 130, 140)), (100*100-25*50, (255, 255, 255, 0))])
示例4: test_negative_offset
def test_negative_offset(self):
sub_img = create_image((150, 150), color=[100, 120, 130, 140])
img = SubImageSource(sub_img, size=(100, 100), offset=(-50, 0), image_opts=ImageOptions()).as_image()
eq_(img.getcolors(), [(100*100, (100, 120, 130, 140))])