How can I modify an image file with Python using no imports? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I modify an image file with Python using no imports?

I know how to modify texts files (format.txt) normally, but, when I try to do the same thing with images... I don't get... Well, I know that open and write the image in binary mode (rb and wb) are necessary, however, I can't to override the image bytes and save them to, for example, get the same image but with its pixels changed. Please, I searched in web, but the unique thing I found was Pillow (damn, I am stupid, cos dunno how to download it on my pc [pip install Pillow doesn't work in my computer by cmd]), help me '-'. Oh, abridgeding, I would like to change the bytes of an image and save them in order to get the same image with different colors and qualitys.

4th Feb 2019, 9:40 PM
Gabriel Felix dos Santos
Gabriel Felix dos Santos - avatar
2 Answers
+ 1
You probably also want to have a look at the sk-image library. For installation instructions pls search the web.
5th Feb 2019, 2:12 AM
Loeschzwerg
0
To install pillow from cmd under python 3, try : py -3 -m pip install pillow The image you can easily modify are bmp files, because there is no compression. While reading a file, use seek function (search on Google). Hope that helps!
4th Feb 2019, 10:28 PM
Théophile
Théophile - avatar