From 760d9c0808e49dcbe0d9966f4669abb8f9db2a81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Sun, 16 Feb 2014 20:39:33 +0000 Subject: [PATCH] using bytes in image type conversions git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx@3598 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- pyx/bitmap.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pyx/bitmap.py b/pyx/bitmap.py index df90ba89..93c34480 100644 --- a/pyx/bitmap.py +++ b/pyx/bitmap.py @@ -332,9 +332,9 @@ class bitmap_trafo(baseclasses.canvasitem): bands = data.split() alpha = bands[0] data = image(self.imagewidth, self.imageheight, mode, - "".join(["".join(values) - for values in zip(*[band.tobytes() - for band in bands[1:]])]), palette=data.palette) + b"".join([bytes(values) + for values in zip(*[band.tobytes() + for band in bands[1:]])]), palette=data.palette) if mode.endswith("A"): bands = data.split() bands = list(bands[-1:]) + list(bands[:-1]) @@ -343,15 +343,15 @@ class bitmap_trafo(baseclasses.canvasitem): alpha = True # TODO: this is slow, but we don't want to depend on PIL or anything ... still, its incredibly slow to do it with lists and joins data = image(self.imagewidth, self.imageheight, "A%s" % mode, - "".join(["".join(values) - for values in zip(*[band.tobytes() - for band in bands])]), palette=data.palette) + b"".join([bytes(values) + for values in zip(*[band.tobytes() + for band in bands])]), palette=data.palette) else: alpha = bands[0] data = image(self.imagewidth, self.imageheight, mode, - "".join(["".join(values) - for values in zip(*[band.tobytes() - for band in bands[1:]])]), palette=data.palette) + b"".join([bytes(values) + for values in zip(*[band.tobytes() + for band in bands[1:]])]), palette=data.palette) if mode == "P": palettemode, palettedata = data.palette.getdata() -- 2.11.4.GIT