Well, it turns out steel gauges doesn't save the gauges as images.  Oh well.

On Mon, Jun 28, 2021 at 8:08 PM Ernest Jillson <[email protected]> wrote:

> Thanks, everyone.
>
> I will definitely need to grab some text from the feed or database, so
> either a simple skin or mqttwarn will work well for that. I have some
> experience with adding text to images using imagemagick. What I really
> would like is some dials. And I just came across a site with steel gauges
> that might be able to create the images I would like to add to the image
> background. Work keeps me busy, but I'm going to try to work on that a
> little at a time over the next few days.
>
> Ernie
>
> On Sun, Jun 27, 2021 at 10:53 PM Andrew Elwell <[email protected]>
> wrote:
>
>> On Mon, 28 Jun 2021 at 08:23, Ernest Jillson <[email protected]> wrote:
>> >
>> > Anyone know of any skins that can produce a static image with most
>> parameters in either text or dial format? The web pages are great, but I'd
>> love to find something that creates an image with T, MaxT, MinT, Wind,
>> Precip (at the least) and ftp it to a friend's web site.
>> >
>> > Thanks in advance,
>>
>> IThe box my webcam (actually a pi + pi camera) is on a different box
>> to my weewx host, I found the easiest way was to save the weather
>> conditions I was interested in via mqttwarn[1] which dumps it down to
>> a local file (since 'loop' outputs may not align with the timings when
>> I need to grab an image.
>>
>> The image is grabbed every 5 mins:
>> pi@stupify:~ $ crontab -l | grep cam
>> */5 5-20 * * * /home/pi/llamacam.py
>>
>> pi@stupify:~ $ cat /home/pi/llamacam.py
>> #!/usr/bin/python3
>> import io
>> import picamera
>> from PIL import Image
>> from PIL import ImageFont,ImageDraw
>> import time
>> import os
>>
>> temperaturefile = '/var/www/html/weewx/test.txt'
>> image_out = '/var/www/html/webcam/latest.jpg'
>>
>> text_overlay = '{}'.format(time.strftime('%a %Y-%m-%d %H:%M %Z'))
>> #print(os.path.getmtime(temperaturefile),time.time(),(time.time() -
>> os.path.getmtime(temperaturefile)))
>> if (time.time() - os.path.getmtime(temperaturefile)<= 300):
>>     with open(temperaturefile, "r") as f:
>>         temperature = float(f.read())
>>     text_overlay += ', Outside Temp: {:.1f}°C'.format(temperature)
>> else:
>>     text_overlay += ' (No temperature reading available)'
>>
>>
>> # Create the in-memory stream
>> stream = io.BytesIO()
>> with picamera.PiCamera() as camera:
>>     camera.led = False
>>     camera.resolution = (1920,1080)
>>     camera.start_preview()
>>     time.sleep(2)
>>     camera.capture(stream, format='jpeg')
>> # "Rewind" the stream to the beginning so we can read its content
>> stream.seek(0)
>> image = Image.open(stream)
>>
>> # add logo to bottom rightt
>> overlay = Image.open("lw_logo.png");
>> image.paste(overlay, (1400,750 ), overlay)
>>
>> # add text too
>> font = ImageFont.truetype("Miriam.ttf", 36)
>> draw = ImageDraw.Draw(image)
>> draw.text((50, 1020), text_overlay, font=font, fill='rgb(0, 168, 162)')
>>
>> image.save(image_out)
>>
>>
>>
>>
>> And that dumps out the following image
>>
>>
>> [1] https://github.com/jpmens/mqttwarn
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "weewx-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/weewx-user/CAANX9yecbCTDTG3C5rezSqpftPcKZ%2BAZOcLOh43XqDw8caEufg%40mail.gmail.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAC5oUmMnvLYyOFPWAuAiig3uVAP3o7DEb2Z-e6ws0%2BFMPMtg2g%40mail.gmail.com.

Reply via email to