Close
0%
0%

Pictures for my mom

the family sending a picture and maybe a text to a specific e-mailadress to display it on a rapsi powered frame.

Similar projects worth following
59 views
0 followers
A python program on a raspi 3b takes the oldest unread e-mail of a specific account and displays the attached image and then sets the e-mail to read. The whole thing every 3 hours and only during the day. If there is an e-mail text between "--" and "--", it will be placed below the image in a maximum of 2 lines and the image will be displayed smaller. The "--" was necessary, because otherwise special characters tend to appear in the various e-mail formats. Initially, I placed the text on the photo in black or white depending on the brightness of the image, which was cool, but not so easy to read, esp. for my mother at the age of 88. Otherwise, the image may be recognized as upright (exif) beforehand and otherwise displayed in the correct format. The display is then fully filled with 16:9 images. Also conceivable with an e ink, but I wanted to have the full image quality here. If there is no e-mail with a new image, the old one will be retained. I also simp

Enjoy this project?

Share

Discussions

Dan Maloney wrote 07/12/2023 at 20:23 point

Something like this but linked to our family Discord would be fantastic for my mom! We share pix all the time, but Gram gets left out because -- well, Discord and 81-year-olds don't mix. Looking forward to more.

  Are you sure? yes | no

Mathias wrote 07/12/2023 at 21:18 point

something like this should display the pics marked with @gram:

import discord

import os

import requests

from PIL import Image

from io import BytesIO

TOKEN = 'YOUR_DISCORD_BOT_TOKEN'

GUILD = 'YOUR_GUILD_NAME'

CHANNEL = 'YOUR_CHANNEL_NAME'

IMAGE_DIR = '/path/to/save/images/'

client = discord.Client()

async def download_and_save_image(url, filename):

    try:

        response = requests.get(url)

        img = Image.open(BytesIO(response.content))

        img.save(os.path.join(IMAGE_DIR, filename))

        os.system('feh --bg-center ' + os.path.join(IMAGE_DIR, filename))

    except Exception as e:

        print('Could not download or save image due to:', e)

@client.event

async def on_message(message):

    if message.author == client.user:

        return

    if '@gram' in message.content:

        if len(message.attachments) > 0:

            for attachment in message.attachments:

                await download_and_save_image(attachment.url, attachment.filename)

@client.event

async def on_ready():

    for guild in client.guilds:

        if guild.name == GUILD:

            break

    print(

        f'{client.user} is connected to the following guild:\n'

        f'{guild.name}(id:

 {guild.id})'

    )

client.run(TOKEN)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates