[ocrfeeder/introspection] Fix problem when converting Gdk.Pixbuf to Image
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder/introspection] Fix problem when converting Gdk.Pixbuf to Image
- Date: Mon, 7 Jul 2014 21:14:09 +0000 (UTC)
commit 6921f15b772ddba08f249196af665f0127e0f4cf
Author: Joaquim Rocha <me joaquimrocha com>
Date: Mon Jul 7 22:43:20 2014 +0200
Fix problem when converting Gdk.Pixbuf to Image
The previously used method was no longer working as Pillow
would complain that "buffer is not large enough" so instead
of using the Image.frombuffer, it now uses Image.frombytes.
src/ocrfeeder/util/graphics.py | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/src/ocrfeeder/util/graphics.py b/src/ocrfeeder/util/graphics.py
index c9ba8e8..c1a858a 100644
--- a/src/ocrfeeder/util/graphics.py
+++ b/src/ocrfeeder/util/graphics.py
@@ -55,11 +55,9 @@ def getBoundsFromStartEndPoints(start_point, end_point):
def convertPixbufToImage(pixbuf):
assert(pixbuf.get_colorspace() == GdkPixbuf.Colorspace.RGB)
dimensions = pixbuf.get_width(), pixbuf.get_height()
- stride = pixbuf.get_rowstride()
pixels = pixbuf.get_pixels()
mode = pixbuf.get_has_alpha() and "RGBA" or "RGB"
- return Image.frombuffer(mode, dimensions, pixels,
- "raw", mode, stride, 1)
+ return Image.frombytes(mode, dimensions, pixels)
def rgbaToInteger(rgba):
r, g, b, a = rgba
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]