If you want to use the date filtering capabilities of your frame — pi3d PictureFrame driven from Home Assistant on an older Pi, or picframe3 on a Pi 4 or Pi 5 — you need your photos to contain valid Exif date information.

This script is stack-independent: it reads your files, not your frame, so it is as useful on picframe3 as it was on pi3d. picframe3 leans on Exif harder, in fact: besides an explicit date range it has rolling windows — today, the last 7, 30 or 90 days, the last year, on this day — that it re-resolves as the days pass. A photograph with no date is invisible to every one of them. If the frame itself is what is misbehaving rather than your files, run picframe3 doctor first; it checks the hardware, drivers, permissions and library and prints the fix for whatever is wrong.

Here is a small Python script to identify all jpg that do not contain proper Exif date information.

I wrote a longer post on this subject here, but I wanted to make an update with the latest Raspberry Pi operating system.

I recommend reading the original post to get more background information on how it works.

The updated python script

Installing and running this script is straightforward.

Create a new file called “exif_date_check.py” with the code below.

#!/usr/bin/env python3

import os
from PIL import Image
from PIL.ExifTags import TAGS

def has_exif_date(image_path):
    try:
        img = Image.open(image_path)
        exif_data = img.getexif()
        if exif_data:
            for tag, value in exif_data.items():
                tag_name = TAGS.get(tag, tag)
                if tag_name == 'DateTimeOriginal':
                    return True
        return False
    except (AttributeError, OSError):
        return False

def list_images_without_exif_date(folder_path):
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            if file.lower().endswith(".jpg"):
                image_path = os.path.join(root, file)
                if not has_exif_date(image_path):
                    print(f"No EXIF date in: {image_path}")

if __name__ == "__main__":
    folder_path = os.path.expanduser("~/Pictures")  # Replace with the path to your photos folder
    list_images_without_exif_date(folder_path)

Specify your photos folder at the bottom of the script and save it. It used to be the bare relative path photos, which only worked if you happened to run the script from the right directory; it now spells out a full path.

One small change in the script itself: it now calls img.getexif() rather than img._getexif(). The old one is a private Pillow method — it still works today, but it is not something Pillow promises to keep, and getexif() is the supported call that does the same job.

Put this file into the home directory of your Raspberry Pi.

To run the script, enter

python3 exif_date_check.py

The output will be printed in the Terminal window, and you can fix those files in Adobe Lightroom or whatever image manipulation software you use.

No EXIF date in: photos/IMG_2329 2.jpg
No EXIF date in: photos/1990. 05.05 - 11.57. 18.jpg
No EXIF date in: photos/IMG_2329.jpg

One limitation to keep in mind: the script only looks at files ending in .jpg. It will not report a .jpeg, a .heic from an iPhone, or a video — all of which picframe3 indexes and filters. Widen the file.lower().endswith(".jpg") check to (".jpg", ".jpeg", ".heic") if you want those covered. Reading Exif out of HEIC needs pillow-heif installed alongside Pillow; picframe3 doctor prints the command for that on a picframe3 frame.

Good photo maintenance makes for a great digital picture frame experience. A little effort goes a long way!