Screen Capture using LV_COLOR_DEPTH 16

Version 8.3.6.

When taking a snapshot of a screen that has image resources as LV_IMG_CF_TRUE_COLOR_ALPHA. They display fine on a 16-bit device (#define LV_COLOR_DEPTH 16), but the screen grab does not capture the images correctly. It also misses the background of the slider widget.

	lv_res_t snap = lv_snapshot_take_to_buf(scr, LV_IMG_CF_TRUE_COLOR_ALPHA,
			&snapshot_img, &img_buffer, sizeof(img_buffer));

Which LVGL version do you use?

8.3.6 github tag

All of the other aspects of the snapshot work and we can successfully create BMPs which get saved to sdcard.

I’ve tried this in the simulator an it works fro me:

  lv_img_dsc_t snapshot_img;
  static uint8_t img_buffer[SDL_HOR_RES * SDL_VER_RES * 3];

  lv_res_t snap = lv_snapshot_take_to_buf(lv_scr_act(), LV_IMG_CF_TRUE_COLOR_ALPHA,
              &snapshot_img, &img_buffer, sizeof(img_buffer));

  lv_obj_t * img = lv_img_create(lv_scr_act());
  lv_img_set_src(img, &snapshot_img);
  lv_img_set_zoom(img, 128);
  lv_obj_set_style_outline_width(img, 5, 0);

You can try running LVGL in GitHub Codespace to be sure we are using the same environment.

Sorry for the delay. We’ve been busy trying to bring this thing up.

Here is the capture:

Here is a photo taken with the camera:

You can see how the OpenHT logo image is not using the right stride. As a side note, the lower slider is missing the blue color as well.

Project is hosted GitHub - M17-Project/OpenHT-fw-test: HAL-based test firmware/GUI for the OpenHT.

Source file is: OpenHT-fw-test/openht_ui.c at main · M17-Project/OpenHT-fw-test · GitHub
…with the _screen_capture() function at the bottom of the file.

Another question: Is there a way to composite the lv_scr_act() and lv_layer_top() UI elements into the same screenshot, so it is representative of what the user sees? I know we can do two separate grabs and combine them offline, but it would be a nice feature if not currently available!


Maybe it’s because of the camera, but the background on the camera image looks much bluer.

Is it case by eye too?

Can you run your project on PC too? (using a simulator)

If so, do you see the same error there?

The camera lighting is making it look blue, IRL it is not :slight_smile:

I will see about getting the simulator option up and running to try to duplicate it.


Do you have a simulator for the latest 8.3 release tagged?

Please this: GitHub - lvgl/lv_port_pc_eclipse at release/v8.3
(release/v8.3 branch)