Ability Screen Shots

Description

Is there a way to save what is currently on the screen to a png or the like? I am sure there is (As the data has to be somewhere right?)

This would be a really cool piece of functionality

What MCU/Processor/Board and compiler are you using?

Raspberry Pi ATM, VisualGDB Visual Studio 2019

What LVGL version are you using?

7.7

What do you want to achieve?

A simple function to call to save a screen shot.

What have you tried so far?

Not quite positive where to start, other than to start digging thru the core.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

The trick that’s usually recommended is to divert the pixels from the display driver to a file.

  1. Set a flag e.g.: screenshot_mode = true
  2. Call lv_obj_invalidate(lv_scr_act());
  3. The driver will get the whole frame in several chunks according to LV_VDB_SIZE. Always full lines will be sent.
  4. If screenshot_mode == true save the parts one by one instead of sending them to the ILI9341
  5. When y2 == LV_VER_RES set screenshot_mode = false to go back to normal mode.

(source)

Very cool…

How difficult would it be to add something like:
save_screenshot(char *filename)

I think it would be easy, except that users’ requirements are different. Some would want a raw buffer to send over the air to another device. Others wouldn’t have enough RAM for that and would want it saved to a file.

Something like this might be better implemented as an example which can be copied into a project, rather than a core function.

Yeah, probs.

But I do like the idea of you doing my homework FOR me :slight_smile:

2 Likes