cancel
Showing results for 
Search instead for 
Did you mean: 

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

ABhan
Associate II

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.​

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

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

View solution in original post

3 REPLIES 3
chaaalyy
Senior II

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
Chief III

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

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.