Replies: 13 comments 6 replies
-
I suppose it would be quite easy to make an overlay that would read an image file. The complexity would be how much flexibility to allow. Maybe a starter would be to simply look in /dev/shm/overlay.png but some way of signalling when to reload that and where to position it might also be minimal requirements. I will think about it a little more. |
Beta Was this translation helpful? Give feedback.
-
from PIL import Image
background = Image.open("test1.png")
foreground = Image.open("test2.png")
background.paste(foreground, (0, 0), foreground)
background.show() Could do the job. Maybe with size and offset info for the foreground image. So it doesn't have to be the same size. Electron saves the bitmap on changes of the website with a frame rate of up to 240. So this should be hopefully fast enough. Even for an analog clock (counting seconds). |
Beta Was this translation helpful? Give feedback.
-
I suppose the simplest signalling would be to check the os last modified time. Having an image reloaded every second would be quite a load but once a minute should be fine. Also the image could be much lower resolution than the display then scaled up by pi3d using the GPU. |
Beta Was this translation helpful? Give feedback.
-
For a static overlay this works pretty well. foreground = Image.open("/Users/herbe/Development/picframe-overlay/ex.png")
foreground = foreground.resize(im.size)
im.paste(foreground, (0, 0), foreground)
tex = pi3d.Texture(im, blend=True, m_repeat=True, free_after_load=True) Have to find out how to do the blending within pi3d mapping 2 textures. |
Beta Was this translation helpful? Give feedback.
-
Hi Paddy, I agree that for a simple clock sprites would be the better idea. But for me, it's more a speed test. My intention is to use a smart speaker and mqtt to show some dashbords. Like weather forecast, the family calendar, dates for waste collection, gasoline price, energy state of my solar battery, urgent messages of my home automation ….. It’s quite easy to render everything into a nice png images. And updating this images only every minute should be fine. But I’m curious how much image refreshes my pi 3 can take. For my 1920x1200 images it has a load of 0.2. (all logs are on ramdisk). So there is still some capacity left. |
Beta Was this translation helpful? Give feedback.
-
Helge, I also think the best route for doing the overlay is rendering to an image file. That way all the variable complexity can be kept out of picframe - there's always a danger of enhancements making it bloated and un-maintainable. With pi3d, the image texture dimensions can be different from the pixel dimensions of the plane that is being rendered and the scaling happens automatically and very efficiently (i.e. as objects move around a scene in a computer game). The other efficiency is that the default pi3d.Texture loading will set the Should I add some extra functionality to the |
Beta Was this translation helpful? Give feedback.
-
I've pushed an addition to the dev branch 05feb15 which simply pastes whatever image is located at I haven't included any config aspects at the moment, it just takes the image and fits it to the screen. Also the blend mode is False which doesn't give any feathering for blurred edges. Possibly many other things that could be improved. Paddy EDIT - I see, just checking the code, that I pushed a version with |
Beta Was this translation helpful? Give feedback.
-
IMG_5894_small.movThanks Paddy, this is so cool! This is on my Mac. Hope I will find time on the weekend to do some Pi testing. By the way: self.__display = pi3d.Display.create(x=self.__display_x, y=self.__display_y,
w=self.__display_w, h=self.__display_h, frames_per_second=self.__fps,
display_config=pi3d.DISPLAY_CONFIG_HIDE_CURSOR,
background=self.__background, use_glx=self.__use_glx, use_sdl2=self.__use_sdl2) sdl2 is not released yet for pi3d? |
Beta Was this translation helpful? Give feedback.
-
I did some tests on my pi3 with https://github.com/helgeerbe/picframe-overlay. The overall performance is quite good. |
Beta Was this translation helpful? Give feedback.
-
That is good; kudos to pillow for being able to load and unpack a png into numpy array so efficiently! I will make a couple of tweaks so that the brightness also works on the clock and overlay, then, provided it works OK, I will pull into main. |
Beta Was this translation helpful? Give feedback.
-
I add a small plugin to picframe-overlay to display the image meta info. |
Beta Was this translation helpful? Give feedback.
-
Very neat! Paddy |
Beta Was this translation helpful? Give feedback.
-
What I want to test:
|
Beta Was this translation helpful? Give feedback.
-
Actual I use electron to create an overlay for picframe. It's a transparent window running in the foreground and rendering e. g. a weather forecast (https://github.com/helgeerbe/picframe-overlay).
This is a little shaky, because it depends on the order you have to start picframe and electron.
@paddywwoof added a text file input to the clock.
I'm wondering now, how performant it would be if electron would render a bitmap (https://www.electronjs.org/docs/latest/tutorial/offscreen-rendering). Picframe would read this file and render it on top of the actual image.
In this way, you can render any website on top of picframe (weather, calendar, analog clock, .....). This would be pretty cool.
Beta Was this translation helpful? Give feedback.
All reactions