[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] BUG: JPEG colors saving a pygame.camera surface
- To: pygame-users@xxxxxxxx
- Subject: [pygame] BUG: JPEG colors saving a pygame.camera surface
- From: Alexandre Quessy <alexandre@xxxxxxxxxx>
- Date: Fri, 17 Apr 2009 09:14:14 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 17 Apr 2009 09:21:29 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=1fe0xKLmmupcWvOUyStISzU2B4sbc0coOh4Hn28P5J8=; b=u+U66gCHqZVzZKB/XxlTML5HU6sHwFb601wUud+dPXjVMMN+Z+xgW1rzTH+zOSPBUZ F5bRDueBV66afqIkHE9Hus6ZVZQTowbN4m+VsQpcXZqtUdyfKPNKB4y4SrUjW6GcqWDT AgZZkWxoS0UToJRye5VKm+O80btU2Xd4tVOXs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=IVoM1a02KKST8NZ326sMduMohkvz/nEmJit/DbdLdVg7ndMWXlt0sEIjIXxaoN9qrl LXspVl+/jlyq2I/SZ3/JP5Mkg3EvKNCXMlRPb98HvX/JpEZsdDTHMn1wyp8MP1+HIqQM EA4vekt5k9oHNQn59LaDgirXXW+lOFuEu3HW4=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hello Pygame people,
This is my first post on this list, and more might follow since I am
using pygame for ToonLoop, a stop motion software. The new
pygame.camera module works for me and this is very good job. Thanks
for contributing that !
I think I found a bug ! Hopefully it is only my code that is wrong and
this is easy to fix.
When I save a Pygame surface that I obtained using pygame.camera to a
JPEG using pygame.image.save, the colors are messed up. It looks like
the red and blue channels are interchanged. Thus, maybe my surface is
RBG, whereas pygame.image expects RGB. A camera image doesn't contain
any alpha channel usually.
When I display the surface as a pygame sprite the colors are OK.
When I display the surface as an OpenGL texture the colors are OK.
(using tostring(surface, "RGBX", True))
When I save the surface as an other format such as PNG or BMP the colors are OK.
When I use a surface obtained by loading a JPG image, the colors are OK.
The bug only occurs when I save a surface obtained using the
pygame.camera module.
It consistently happened on 3 Linux computers.
I use Pygame compiled from today's SVN with Python 2.5.2 on Ubuntu
GNU/Linux 8.10 using a V4L2 device. (a WinTV card)
A short code snippet to reproduce the bug:
http://rafb.net/p/gccaJG37.html
A JPEG to see how the output looks like :
http://toonloop.com/static/tmp/image_color_test_out.jpg
A correct image in an other format to compare :
http://toonloop.com/static/tmp/image_color_test_out.png
If you want to download the code and the test image I use :
http://toonloop.com/static/tmp/bug_color_jpeg.tar.gz
I also convert the colorbars.jpg files to surface and back to a JPG
file for comparison. It works flawlessly.
--
Alexandre Quessy
http://alexandre.quessy.net/