Page 1 of 1

Screenshot of LCR160CR ?

Posted: Sat Dec 30, 2017 3:54 pm
by rcolistete
What about screenshot of LCR160CR being saved to picture file (.jpeg, .png., etc) on internal flash or external flash (microSD) ? Has anybody implemented this feature ?

Maybe using the framebuffer, converting the frame buffer format to a picture format.

Yes, I know that the LCD160 module can show jpeg pictures.

Re: Screenshot of LCR160CR ?

Posted: Wed Jan 03, 2018 9:27 am
by chuckbook
See

Code: Select all

LCD160CR.screen_dump(buf, x=0, y=0, w=None, h=None)
Note that buf holds pixels in RGB565 format.

Re: Screenshot of LCR160CR ?

Posted: Fri Jan 05, 2018 11:51 pm
by rcolistete
chuckbook wrote:
Wed Jan 03, 2018 9:27 am
See

Code: Select all

LCD160CR.screen_dump(buf, x=0, y=0, w=None, h=None)
Note that buf holds pixels in RGB565 format.
Thanks.
So the buffer could be saved to a binary file in RGB565 format.
Then I can copy the RGB565 files to a PC and use a PC tool (imagemagic, ffmpeg, etc) to convert the format to PNG, etc.

Re: Screenshot of LCR160CR ?

Posted: Sat Jan 06, 2018 7:08 am
by pythoncoder
There's a bit more to it than that. A binary file provides no clues about the screen dimensions (in pixels). My approach would be to do as you suggest, but then to write a utility in Python to run on the PC to convert the file to a standard graphics format. Go for a simple uncompressed format like BMP.

Re: Screenshot of LCR160CR ?

Posted: Sat Jan 06, 2018 12:53 pm
by rcolistete
Good idea to convert RGB565 to bmp.

I'll look at OpenMV MicroPython source code to try to get MicroPython code to save in BMP format (in the image module) :
http://docs.openmv.io/library/omv.image ... image.save
But I guess it is implemented in C/C++ :
https://github.com/openmv/openmv/tree/master/src/omv/py

Re: Screenshot of LCR160CR ?

Posted: Sat Jan 06, 2018 4:34 pm
by rcolistete
It seems PPM image file format is simpler than BMP, easier to code even in MicroPython. For example :
PPM image from scratch in Python 3
nicholasRutherford/ppmFile.py
MANDELBROT FRACTAL IMAGE OUTPUT TO PPM FILE (PYTHON RECIPE)

PPM image format

Posted: Sun Jan 07, 2018 5:10 pm
by pythoncoder
Thanks for that - I'm sure that will come in handy. Converting to PPM looks very easy and Gimp can process the file. :)