Exemplo n.º 1
0
    def test_sanity(self):

        self.assertRaises(ValueError, lambda: hopper().tobitmap())

        im1 = hopper().convert("1")

        bitmap = im1.tobitmap()

        self.assertIsInstance(bitmap, bytes)
        self.assert_image_equal(im1, fromstring(bitmap))
Exemplo n.º 2
0
    def test_sanity(self):

        self.assertRaises(ValueError, lambda: hopper().tobitmap())

        im1 = hopper().convert("1")

        bitmap = im1.tobitmap()

        self.assertIsInstance(bitmap, bytes)
        self.assert_image_equal(im1, fromstring(bitmap))
Exemplo n.º 3
0
    def test_safeblock(self):
        if "zip_encoder" not in codecs:
            self.skipTest("PNG (zlib) encoder not available")

        im1 = hopper()

        try:
            ImageFile.SAFEBLOCK = 1
            im2 = fromstring(tostring(im1, "PNG"))
        finally:
            ImageFile.SAFEBLOCK = SAFEBLOCK

        self.assert_image_equal(im1, im2)
Exemplo n.º 4
0
    def test_safeblock(self):
        if "zip_encoder" not in codecs:
            self.skipTest("PNG (zlib) encoder not available")

        im1 = hopper()

        try:
            ImageFile.SAFEBLOCK = 1
            im2 = fromstring(tostring(im1, "PNG"))
        finally:
            ImageFile.SAFEBLOCK = SAFEBLOCK

        self.assert_image_equal(im1, im2)
Exemplo n.º 5
0
def draft(mode, size):
    im = fromstring(DATA)
    im.draft(mode, size)
    return im
Exemplo n.º 6
0
 def draft_roundtrip(self, in_mode, in_size, req_mode, req_size):
     im = Image.new(in_mode, in_size)
     data = tostring(im, 'JPEG')
     im = fromstring(data)
     im.draft(req_mode, req_size)
     return im
Exemplo n.º 7
0
 def draft_roundtrip(self, in_mode, in_size, req_mode, req_size):
     im = Image.new(in_mode, in_size)
     data = tostring(im, 'JPEG')
     im = fromstring(data)
     im.draft(req_mode, req_size)
     return im
Exemplo n.º 8
0
def draft(mode, size):
    im = fromstring(data)
    im.draft(mode, size)
    return im
Exemplo n.º 9
0
def draft(mode, size):
    im = fromstring(DATA)
    im.draft(mode, size)
    return im
Exemplo n.º 10
0
def draft(mode, size):
    im = fromstring(data)
    im.draft(mode, size)
    return im