AndrewFromMelbourne / raspi2png

Utility to take a snapshot of the Raspberry Pi screen and save it as a PNG file
MIT License
213 stars 78 forks source link

raspi2png is too slow #9

Closed ghost closed 8 years ago

ghost commented 8 years ago

It almost takes 2 seconds to take a picture, is it possible to improve performance?

AndrewFromMelbourne commented 8 years ago

No, not really. The program is relatively simple. You may get some improvement if you write the captured file to a ram drive, rather than to the sdcard. Other than that the only option to speed things up would be to get the GPU to do the file encoding.

AndrewFromMelbourne commented 8 years ago

I have added a command line option to set the compression level of the PNG image. If you set a low compression level (default is 6), then the compression of the image should take less time. However the resulting PNG file will be larger and may take longer to save.

ghost commented 8 years ago

Thank you, actually I want to convert screenshot to jpg for lower image size, because I want to transmit it over wire, so let's see if imagemagic can convert image faster or not

AndrewFromMelbourne commented 8 years ago

Have a look at @dividuum's screenshot. It takes a snapshot and writes a JPG to stdout.

dividuum commented 8 years ago

It should also be possible to use OMX to offload the jpeg encoding to the GPU. Since the CPU version works well enough for now I didn't look into that yet.

AndrewFromMelbourne commented 8 years ago

@dividuum Yes, you could use OMX or MMAL to encode the jpeg on the GPU. On the Pi 2B it may not be worth the extra effort.

ghost commented 8 years ago

@AndrewFromMelbourne thank you @dividuum's screenshot is fast and file size is small. Feel free to close issue.