[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generate simple image on a standalone Raspberrry Pi

In comp.lang.python, Roy Hann  <specially at processed.almost.meat> wrote:
> I am designing a mobile application to run on a Raspberry Pi 3 model B.
> It will not have any Internet access. I need to generate a static image
> consisting of a simple arc representing (say) a speedometer or a
> pressure gauge. The image will need to be regenerated every 5 seconds.
> The image must be displayed in a web browser (served by gunicorn
> running on the Pi). I prefer it to be a PNG but that is only a
> preference.

The browser can probably display SVG. So generating that may be easier.
Is the browser running on the same system? You say no "Internet access",
but that's not the same as "no network access". A browser running on a
different local system might have more CPU oomph to handle the "SVG to
bitmap for display" step.

I've used libpng from C and chunky_png from ruby and not found PNG
generation too onerous. That makes me think pypng wouldn't be bad
either. For the case of a speedometer / pressure gauge you can likely
have a blank gauge file you read in each time through the loop and then
only write the changes needed (eg, the needle).

Alternatively the guage could be a static image in the browser with an
overlaid dynamic needle image using a transparent background. The PNG
format will handle that easily.

thinks there are a lot of unstated parts to this problem