Page 1 of 1
read / write png files
Posted: Mon Jul 04, 2022 4:05 pm
by ps_nithin
Is there any way to read / write png files with micropython?
Re: read / write png files
Posted: Mon Jul 04, 2022 4:22 pm
by karfas
Of course, like any other file

.
Way too less information here.
Where does your graphic data come from?
What is wrong with e.g.
https://github.com/Ratfink/micropython- ... ter/png.py (first Google hit when searching "micropython PNG") ?
Re: read / write png files
Posted: Mon Jul 04, 2022 4:27 pm
by ps_nithin
I want to read / write png files from flash storage. i am able to read png files with
https://github.com/Ratfink/micropython- ... ter/png.py but that library does not allow me to write png files.
Re: read / write png files
Posted: Tue Jul 05, 2022 6:41 am
by rkompass
Just out of curiosity:
Did you try to comment out the Writer class?
Re: read / write png files
Posted: Tue Jul 05, 2022 8:28 am
by ps_nithin
I haven't tried that.

But why would the author comment it out if it works good.
Re: read / write png files
Posted: Tue Jul 05, 2022 11:00 pm
by karfas
You didn't answer my question "Where does your graphic data come from?".
Depending upon your application, it might be sufficient to write files using a simpler format (TIFF, GIF) or render the PNG files elsewhere (e.g. in a web browser).
Re: read / write png files
Posted: Wed Jul 06, 2022 2:48 am
by ps_nithin
In my case I want to read png file from onboard storage, run some image processing algorithms and write the output back to onboard storage as png file. Then view the output png from pc.
Re: read / write png files
Posted: Wed Jul 06, 2022 2:55 am
by ps_nithin
karfas wrote: ↑Tue Jul 05, 2022 11:00 pm
You didn't answer my question "Where does your graphic data come from?".
Depending upon your application, it might be sufficient to write files using a simpler format (TIFF, GIF) or render the PNG files elsewhere (e.g. in a web browser).
How can i write files in tiff / gif format. Is there a library for that? Also, how can I render png in a web browser without writing a png file?