Skip to main content

photoage

Calculate the age of a photo.

Install

$ pip3 install photoage

Usage

Library

import datetime
import photoage

# returns the number of days since epoch
photoage.calculate_days('/path/to/photo.jpg')

# returns the number of days since 2017/06/06
photoage.calculate_days('/path/to/photo.jpg',
        birthday=datetime.datetime(2017, 6, 6))

# same, except that the cutting point is 03:00:00 everyday instead of 00:00:00
photoage.calculate_days('/path/to/photo.jpg',
        birthday=datetime.datetime(2017, 6, 6),
        offset=datetime.timedelta(hours=3))

# same, except that it specifies the methods to find out the date time of the photo
# by the way, the default value of the argument `methods` is `('exif',)`
# the current supported methods are "exif" and "stat"
photoage.calculate_days('/path/to/photo.jpg',
        birthday=datetime.datetime(2017, 6, 6),
        methods=('exif', 'stat'))

# get the date time from a photo
# it will return a datetime.datetime object
photoage.get_date_time('/path/to/photo.jpg')

# get the date time from a photo with specified methods
photoage.get_date_time('/path/to/photo.jpg', methods=('exif', 'stat'))

Command-line Tool

Basic usages are:

$ photoage /path/to/photo.jpg
/path/to/photo.jpg: 17325 days since 1970/01/01
$ photoage --birthday=2017/06/06 /path/to/photo.jpg
/path/to/photo.jpg: 2 days since 2017/06/06
$ photoage --birthday=2017/06/06 --offset=03:00:00 /path/to/photo.jpg
/path/to/photo.jpg: 2 days since 2017/06/06
$ photoage --birthday=2017/06/06 /path/to/photos/*.jpg
/path/to/photos/1.jpg: 2 days since 2017/06/06
/path/to/photos/2.jpg: 5 days since 2017/06/06
/path/to/photos/3.jpg: 0 days since 2017/06/06
/path/to/photos/4.jpg: 2 days since 2017/06/06
/path/to/photos/5.jpg: unknown date of photo token
$ photoage --birthday=2017/06/06 --summary /path/to/photos/*.jpg
total number of photo(s): 3 photos
first photo: /path/to/photos/3.jpg, 0 days since 2017/06/06
latest photo: /path/to/photos/2.jpg, 5 days since 2017/06/06
3 missing photo(s): 1, 3, 4 days since 2017/06/06
1 set(s) of duplicate photos:
- 2 days since 2017/06/06: /path/to/photos/1.jpg, /path/to/photos/4.jpg
1 photo(s) with unknown date:
- /path/to/photos/5.jpg
$ photoage --auto-detect-birthday /path/to/photos/*.jpg
/path/to/photos/1.jpg: 2 days since 2017/06/06
/path/to/photos/2.jpg: 5 days since 2017/06/06
/path/to/photos/3.jpg: 0 days since 2017/06/06
/path/to/photos/4.jpg: 2 days since 2017/06/06
/path/to/photos/5.jpg: unknown date of photo token

Other options can be found by typing:

$ photoage --help

Release files for photoage 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 photoage 0.1.1
File Size Uploaded
photoage-0.1.1.tar.gz 3.9 kB Details

Built distribution (wheel)

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

Total release size: 9.3 kB

Release files / photoage-0.1.1.tar.gz

Download URL photoage-0.1.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1ee0e38916b5965f9a2a112fc2e15468aa435add1f1ffe9e9c6951f893d4774
BLAKE2b-256 checksum
How to use checksums
670e650692962e4329af70a6afbc9ad55505020d7a99356239add52c80515a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.16

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

Download URL photoage-0.1.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85d575c115a9605531b3d93f0e252d6a45e9f5e8ec05a5514b41ae9deb06e5a5
BLAKE2b-256 checksum
How to use checksums
2fdbaa01fd52e69e926f1b805fca6d935b6c41a4b35f9eb426debc2ab9ad832e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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