Skip to main content
ABhan
Associate II
Apr 23, 2020 9:52 AM UTC
Solved

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

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.
Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
Apr 27, 2020 10:33 AM UTC

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

3 replies

chaaalyy
Senior II
Apr 23, 2020 6:09 PM UTC

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
Apr 27, 2020 10:33 AM UTC

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
Apr 30, 2020 11:08 AM UTC

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.