Screenshot of LCR160CR ?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
rcolistete
Posts: 109
Joined: Thu Dec 31, 2015 3:12 pm

Screenshot of LCR160CR ?

Post by rcolistete » Sat Dec 30, 2017 3:54 pm

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.

chuckbook
Posts: 45
Joined: Fri Oct 30, 2015 11:55 pm

Re: Screenshot of LCR160CR ?

Post by chuckbook » 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.

rcolistete
Posts: 109
Joined: Thu Dec 31, 2015 3:12 pm

Re: Screenshot of LCR160CR ?

Post by rcolistete » Fri Jan 05, 2018 11:51 pm

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.

User avatar
pythoncoder
Posts: 2587
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Screenshot of LCR160CR ?

Post by pythoncoder » Sat Jan 06, 2018 7:08 am

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.
Peter Hinch

rcolistete
Posts: 109
Joined: Thu Dec 31, 2015 3:12 pm

Re: Screenshot of LCR160CR ?

Post by rcolistete » Sat Jan 06, 2018 12:53 pm

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

rcolistete
Posts: 109
Joined: Thu Dec 31, 2015 3:12 pm

Re: Screenshot of LCR160CR ?

Post by rcolistete » Sat Jan 06, 2018 4:34 pm

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)

User avatar
pythoncoder
Posts: 2587
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

PPM image format

Post by pythoncoder » Sun Jan 07, 2018 5:10 pm

Thanks for that - I'm sure that will come in handy. Converting to PPM looks very easy and Gimp can process the file. :)
Peter Hinch

Post Reply