def test_full(self): data = image_encoding.html_to_png('') image = Image.open(data) image = image_encoding.crop_384(image) image = image_encoding.convert_to_1bit(image) n_bytes, _ = image_encoding.rle_from_bw(image) self.assertEquals(n_bytes, 3072)
def test_full(self): data = image_encoding.html_to_png('') image = Image.open(data) image = image_encoding.crop_384(image) image = image_encoding.threshold(image) n_bytes, _ = image_encoding.rle_from_bw(image) self.assertEquals(n_bytes, 3072)
def _check_html(self, name, html): print('Cheking fixture named: %s' % name) with TemporaryDirectory() as tmpdir: data = image_encoding.html_to_png(html) image = Image.open(data) temp_file_name = os.path.join(tmpdir, '%s.png' % name) image.save(temp_file_name, format='PNG') self.assertMatchSnapshot(FileSnapshot(temp_file_name), name)
def test_full(self): data = image_encoding.html_to_png( '<html><body style="margin: 0px; height: 10px;"></body></html>') image = Image.open(data) image = image_encoding.crop_384(image) image = image_encoding.convert_to_1bit(image) n_bytes, _ = image_encoding.rle_from_bw(image) self.assertEquals(n_bytes, 3840)
def _test_normal_text(self): data = image_encoding.html_to_png('') image = Image.open(data) self.assertEquals(image.size[0], 384)
def _test_rle(self): data = image_encoding.html_to_png('') image = Image.open(data) n_bytes, _ = image_encoding.rle_image(data) self.assertEquals(n_bytes, 3072)
def _test_normal_height(self): data = image_encoding.html_to_png( '<html><body style="margin: 0px; height: 100px;"></body></html>') image = Image.open(data) self.assertEquals(image.size[1], 100)