use png when converting from a QImage to a Pillow Image - #1429
Conversation
|
@ericfrederich The build fails: The others pass, but the failing Python2.7_with_system_site_packages is the only one to test with Qt. |
d5d029e to
1b134bb
Compare
|
@hugovk Please review again. It no longer errors out. My goal was to preserve alpha while round tripping. This now works so I'd appreciate the merge. I added tests for this an discovered a bug. I will write the code to guarantee the alignment and then cleanup the test file. |
|
Is this going to require zlib to work? |
|
@wiredfool Can you explain what you mean with zlib? This pull request "works" as good as it did before and adds the ability to round-trip images with alpha channels. The fix I'm talking about implementing (later tonight perhaps) shouldn't require zlib. |
|
Because png has a dependency on zlib. |
|
@wiredfool this fix is about round-tripping between PIL and Qt. I couldn't imagine a system which has Qt but no zlib. How would you suggest to preserve alpha? |
Images in Qt show up incorrectly if each line is not aligned to 32 bits. It is pretty common for an image's lines to be 32-bit alinged by chance. Obviously any 32-bit image will not have any problem. For the bug to manifest itself you'd need... * a 1-bit image whose width is not a multiple of 32 * an 8-bit image who width is not a multiple of 4 Testing more images now and added a 7x13 png test image
eaf0041 to
e67a4c4
Compare
|
I rebased this on top of #1430 since some tests depended on it which had to be commented out. |
|
Looks like zlib is required for qt, so as long as we have a functioning pillow install, this should work. However, since we don't actually compile against qt (its just a runtime thing), a badly installed pillow that doesn't have any of the optional C dependencies would break here. On the other hand, I'm really pushing for zlib as a required dependency. |
use png when converting from a QImage to a Pillow Image
ppm doesn't have an alpha channel
png has alpha channel, should be able to convert back and forth now
without losing anything