daily-portrait
daily-portrait copied to clipboard
Automatically align portraits and create a time-lapse video. (photo a day)
daily-portrait
Automatically align portraits and create a time-lapse video.
Install
pip install poetrypoetry installpoetry shell
Usage
- Put all photos to
./input - Run
cp daily_portrait/local_settings.sample.py daily_portrait/local_settings.py - Modify
daily_portrait/local_settings.py, if you want change the default settings.crop_rate = 0.8 pil_min_filter_size = 0 # odd number must >=3, set 0 to no effect fps = 4 # (width, height), if width=0, height will auto calculate by width frame_size: tuple[int, int] | None = None - Run
python app.py- processed photos are in
./output - The output video is
out.gifandout.avi
- processed photos are in
How it works
- Rename each photo by its date in EXIF data.
- If a photo does not have EXIF data, keep its original name.
- Resize all photos to match the size of the first photo.
- Align face
- Locate the two eyes in the photo.
- Find the center point between the two eyes.
- Rotate the photo to make the eyes horizontal.
- Move the photo to align the center point.
- Scale the face based on the distance between the eyes.
- Crop the face according to the ratio in the settings.
- Adjust each photo to fit the frame size.
- Add the date to each photo using the EXIF data. If a photo does not have EXIF data, skip this step.
- Save each photo to the output directory.
- Create a video from the photos in the output directory.