Skip to main content

photo-sorter.py

master develop
build status build status

Logo

This is a python script to automatically sort photos from a Canon camera. In principle, this should also work with other directories containing images, but it is primarily done for the Canon Powershot G7 X's image structure.

The script assumes a directory structure like this;

- DCIM
-- images&videos_1
-- images&videos_2
-- ...
-- images&videos_n
-- CANONMSC (optional, will be deleted)

What does the script do?

1. Set up new folder structure

First, it will create a new directory structure like so:

- DCIM
-- Images
--- Raw
--- High Quality
--- Low Quality
-- Videos

and move all relevant image and video files in the directories.

  • Raw files (.CR2) will be put into the Images/Raw directory
  • JPG files will be put into the Images/High Quality directory
  • MP4 files will be put into the Videos directory

2. Look for missing JPG files

If Raw files exist without a corresponding JPG file, the .CR2 file's preview image will be extracted and equiped with the same exif data as the .CR2 file and stored in the Images/High Quality folder.

3. Rename according to exif data

All image files will be renamed according to their exif timestamp. The file names will follow the format YY-MM-DD---hh-mm--ss

4. Create lower quality JPG files

All High Quality JPG files are converted down to ~1080p (1920x1080 / 1080x1920) and put into the Images/Low Quality folder

Optional: Merge

If more than one directory is passed as an argument, These directories are first processed with Steps 1-4 indivdually and then merged. The resulting folder will be called Merged

How do I use this script?

Just call the script using photo-sorter <directory 1> <directory 2> ... <directory n>.

This will process each directory individually and then merge them together.

Dependencies:

The following commands need to be installed and in the system's PATH:

  • exiftool
  • jpegoptim
  • convert (Part of imagemagick)

To install these on Arch Linux, run the following command:

sudo pacman -S imagemagick jpegoptim perl-image-exiftool

Installation on other distributions may differ.

Further Information

Metadata

Release files for photo-sorter 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for photo-sorter 0.1.1
File Size Uploaded Provenance
photo-sorter-0.1.1.tar.gz 6.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for photo-sorter 0.1.1
File Interpreter ABI Platform
photo_sorter-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.2 kB

Release files / photo-sorter-0.1.1.tar.gz

Download URL photo-sorter-0.1.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
32f32636b8bb8012ea92034bb66220f1dce405c0a8aeb2fa0c0bab9192dc2f8b
BLAKE2b-256 checksum
How to use checksums
deeccda12a66bedf66ce63fa33334c3ecf3b278c3c7c6d9a2854340e96e87eb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

Release files / photo_sorter-0.1.1-py3-none-any.whl

Download URL photo_sorter-0.1.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5f7456b6ad6cd147346aa83d106aafda336a1639dc315ec5016fd9e29b18333
BLAKE2b-256 checksum
How to use checksums
ba76aabaf3d776e548934137ae403c9f6c08d87ccbb4937dc7c4f054c075b84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

Security for photo-sorter 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page