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


Python image.make_transparent函数代码示例

本文整理汇总了Python中mapproxy.image.make_transparent函数的典型用法代码示例。如果您正苦于以下问题:Python make_transparent函数的具体用法?Python make_transparent怎么用?Python make_transparent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_from_paletted

 def test_from_paletted(self):
     img = self._make_test_image().quantize(256)
     img = make_transparent(img, (130, 150, 120), tolerance=5)
     assert img.mode == 'RGBA'
     assert img.size == (50, 50)
     colors = img.getcolors()
     eq_(colors, [(1600, (130, 140, 120, 255)), (900, (130, 150, 120, 0))])
开发者ID:atrawog,项目名称:mapproxy,代码行数:7,代码来源:test_image.py

示例2: test_with_color_fuzz

 def test_with_color_fuzz(self):
     img = self._make_test_image()
     img = make_transparent(img, (128, 154, 121), tolerance=5)
     assert img.mode == 'RGBA'
     assert img.size == (50, 50)
     colors = img.getcolors()
     assert colors == [(1600, (130, 140, 120, 255)), (900, (130, 150, 120, 0))]
开发者ID:atrawog,项目名称:mapproxy,代码行数:7,代码来源:test_image.py

示例3: test_no_match

 def test_no_match(self):
     img = self._make_test_image()
     img = make_transparent(img, (130, 160, 120), tolerance=5)
     assert img.mode == 'RGBA'
     assert img.size == (50, 50)
     colors = img.getcolors()
     assert colors == [(1600, (130, 140, 120, 255)), (900, (130, 150, 120, 255))]
开发者ID:atrawog,项目名称:mapproxy,代码行数:7,代码来源:test_image.py

示例4: test_from_transparent

 def test_from_transparent(self):
     img = self._make_transp_test_image()
     draw = ImageDraw.Draw(img)
     draw.rectangle((0, 0, 4, 4), fill=(130, 100, 120, 0))
     draw.rectangle((5, 5, 9, 9), fill=(130, 150, 120, 255))
     img = make_transparent(img, (130, 150, 120, 120), tolerance=5)
     assert img.mode == 'RGBA'
     assert img.size == (50, 50)
     colors = sorted(img.getcolors(), reverse=True)
     eq_(colors, [(1550, (130, 140, 120, 100)), (900, (130, 150, 120, 0)),
         (25, (130, 150, 120, 255)), (25, (130, 100, 120, 0))])
开发者ID:atrawog,项目名称:mapproxy,代码行数:11,代码来源:test_image.py

示例5: get_map

    def get_map(self, query):
        if self.res_range and not self.res_range.contains(query.bbox, query.size, query.srs):
            raise BlankImage()
        if self.coverage and not self.coverage.intersects(query.bbox, query.srs):
            raise BlankImage()
        try:
            resp = self._get_map(query)
            if self.transparent_color:
                resp = make_transparent(resp, self.transparent_color, self.transparent_color_tolerance)
            resp.opacity = self.opacity
            return resp

        except HTTPClientError, e:
            log.warn("could not retrieve WMS map: %s", e)
            reraise_exception(SourceError(e.args[0]), sys.exc_info())
开发者ID:rduivenvoorde,项目名称:mapproxy,代码行数:15,代码来源:wms.py


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