Skip to main content
ABhan
Associate II
April 23, 2020
Solved

How to take current screenshot and save it into mass storage.

  • April 23, 2020
  • 2 replies
  • 1175 views

I want to take current screen screenshot and save it into JPEG or BMP image file format in mass storage.

I have seen saveScreenshot() function, but this is for Simulator.

I want to svae screenshot in STM32L4R5.

​Please comment if you have answers on this.

Thank you.​

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Shouldn't be difficult to use something like libJPEG to create an image based on the pixels in the framebuffer, and then store it to some mass storage.

You can use something like the SnapShotWidget to create a copy of the framebuffer into another memory region, or you can create a custom widget that calls lockFrameBuffer(), adds a header, reads the pixels, converts them if necessary and stores them to sd-card.

/Martin

2 replies

chaaalyy
Senior II
April 23, 2020

Good question (and i finally can´t answer it...). My approach would be: reading the actual framebuffer, adding a bmp header (as the format is known, when doing so ...) and save that alltogether into a file ...

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
April 27, 2020

Shouldn't be difficult to use something like libJPEG to create an image based on the pixels in the framebuffer, and then store it to some mass storage.

You can use something like the SnapShotWidget to create a copy of the framebuffer into another memory region, or you can create a custom widget that calls lockFrameBuffer(), adds a header, reads the pixels, converts them if necessary and stores them to sd-card.

/Martin

ABhan
ABhanAuthor
Associate II
April 30, 2020

Hi Martin,

Thanks for your support.

Yes i doing the same, lockFrameBuffer() and write buffer with image header​. but the screenshot file is to much big.