+ 1

How do I manipulate a PNG in Python?

Yeah, I would want to manipulate black-white (only black and white pixels, not gray) images, just get the color value of a pixel at a specific coordinate and set the pixel color (still black or white) for a specific coordinate to a PNG and at last also create PNG files. Is there a (simple) way to do this without external libraries or are they basically a must have?

18th Sep 2019, 3:40 PM
Joel Kronqvist
Joel Kronqvist - avatar
6 ответов
+ 2
Check the PIL library, dm me if you want
18th Sep 2019, 3:52 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Of course it does, I use PIL
18th Sep 2019, 4:40 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
"The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later. -pythonware.com/products/pil/ There's apparently no version for python 3, will it work? Aymane Boukrouh Yeah, and thanks for answering my question, even if I got questions about the answer😁
18th Sep 2019, 4:22 PM
Joel Kronqvist
Joel Kronqvist - avatar
+ 1
You could quite easily manipulate some image files with Pygame.
18th Sep 2019, 4:25 PM
Seb TheS
Seb TheS - avatar
+ 1
I think you can convert it to a numpy array and mess with it like that. I’ve done it with DICOMs, but not with PNGs, although I assume it would be similar.
18th Sep 2019, 9:47 PM
Rora
0
Jan Markus where you been?
21st Sep 2019, 7:38 PM
Kidale Smith
Kidale Smith - avatar