[Image-SIG] Skewing when converting with ImageQt

Fredrik Lundh fredrik at pythonware.com
Mon Jun 22 16:32:45 CEST 2009

On Mon, Jun 22, 2009 at 3:06 PM, Carl Petterson<Carl.Petterson at tobii.com> wrote:
> Hi!
> I’m using PIL to load .pgm images into an application. They are to be
> displayed as QPixmaps in a Qt app, so I’m using the ImageQt class to convert
> my PIL images to QImages, and later QPixmaps. However, for some - but not
> all - pictures, the resulting image is skewed. It looks fine if I do
> Image.show() on it before conversion, and if I load it via Qt directly it’s
> also fine.

Looks like PIL doesn't do line alignment correctly for mode L and P
images (at least).  Hmm.

Can you check if it works correctly if the width is a multiple of 4?

What happens if you explicitly convert the image to RGB before passing
it to the wrapper?

(Are you using the ImageQt file from
http://svn.effbot.org/public/stuff/sandbox/pil/ImageQt.py or some
other version, btw?  I doubt the one in 1.1.7 works any better than
that one, though, but it's good to know what code you've been using).


More information about the Image-SIG mailing list