本文整理汇总了Python中mapproxy.test.image.is_jpeg函数的典型用法代码示例。如果您正苦于以下问题:Python is_jpeg函数的具体用法?Python is_jpeg怎么用?Python is_jpeg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_jpeg函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_converted_output
def test_converted_output(self):
ir = ImageSource(self.tmp_filename, (100, 100), PNG_FORMAT)
assert is_png(ir.as_buffer())
assert is_jpeg(ir.as_buffer(JPEG_FORMAT))
assert is_jpeg(ir.as_buffer())
assert is_tiff(ir.as_buffer(TIFF_FORMAT))
assert is_tiff(ir.as_buffer())
示例2: test_get_tile
def test_get_tile(self):
resp = self.app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/01/0/0.jpeg")
eq_(resp.content_type, "image/jpeg")
data = BytesIO(resp.body)
assert is_jpeg(data)
# test without leading 0 in level
resp = self.app.get("/wmts/myrest/wms_cache/GLOBAL_MERCATOR/1/0/0.jpeg")
eq_(resp.content_type, "image/jpeg")
data = BytesIO(resp.body)
assert is_jpeg(data)
示例3: test_get_tile_w_rounded_bbox
def test_get_tile_w_rounded_bbox(self):
self.common_map_req.params.bbox = '-20037400,0.0,0.0,20037400'
resp = self.app.get(str(self.common_map_req) + '&tiled=true')
assert 'public' in resp.headers['Cache-Control']
eq_(resp.content_type, 'image/jpeg')
data = BytesIO(resp.body)
assert is_jpeg(data)
示例4: test_get_tile_uncached
def test_get_tile_uncached(self):
resp = self.app.get('/tms/1.0.0/wms_cache/0/0/0.jpeg')
eq_(resp.content_type, 'image/jpeg')
data = StringIO(resp.body)
assert is_jpeg(data)
img = Image.open(data)
eq_(img.mode, 'RGB')
eq_(img.getcolors(), [(256*256, (255, 255, 255))])
示例5: test_wmts
def test_wmts(self):
resp = self.app.get(
str(self.common_tile_req),
extra_environ={'mapproxy.decorate_img': to_greyscale}
)
eq_(resp.content_type, 'image/jpeg')
eq_(resp.content_length, len(resp.body))
data = StringIO(resp.body)
assert is_jpeg(data)
示例6: test_tms
def test_tms(self):
resp = self.app.get(
'/tms/1.0.0/wms_cache/0/0/1.jpeg',
extra_environ={'mapproxy.decorate_img': to_greyscale}
)
eq_(resp.content_type, 'image/jpeg')
eq_(resp.content_length, len(resp.body))
data = StringIO(resp.body)
assert is_jpeg(data)
示例7: test_get_tile_cached
def test_get_tile_cached(self):
resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
eq_(resp.content_type, 'image/jpeg')
data = BytesIO(resp.body)
assert is_jpeg(data)
img = Image.open(data)
eq_(img.mode, 'RGB')
# cached image has more that 256 colors, getcolors -> None
eq_(img.getcolors(), None)
示例8: _check_tile_resp
def _check_tile_resp(self, resp):
eq_(resp.content_type, 'image/jpeg')
eq_(resp.content_length, len(resp.body))
data = StringIO(resp.body)
assert is_jpeg(data)
示例9: test_get_tile
def test_get_tile(self):
resp = self.app.get(str(self.common_tile_req))
eq_(resp.content_type, 'image/jpeg')
data = BytesIO(resp.body)
assert is_jpeg(data)
示例10: test_get_cached_tile
def test_get_cached_tile(self):
resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
eq_(resp.content_type, 'image/jpeg')
eq_(resp.content_length, len(resp.body))
data = BytesIO(resp.body)
assert is_jpeg(data)
示例11: test_get_cached_tile_request_origin
def test_get_cached_tile_request_origin(self):
resp = self.app.get('/tiles/wms_cache/1/0/1.jpeg?origin=sw')
eq_(resp.content_type, 'image/jpeg')
assert is_jpeg(resp.body)
示例12: test_get_cached_tile_tms
def test_get_cached_tile_tms(self):
resp = self.app.get('/tms/1.0.0/wms_cache/0/0/1.jpeg')
eq_(resp.content_type, 'image/jpeg')
assert is_jpeg(resp.body)
示例13: test_get_tile
def test_get_tile(self):
resp = self.app.get(str(self.common_map_req) + '&tiled=true')
assert 'public' in resp.headers['Cache-Control']
eq_(resp.content_type, 'image/jpeg')
data = BytesIO(resp.body)
assert is_jpeg(data)