Skip to main content

Calculate the age of a photo.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

photoage-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

photoage-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file photoage-0.1.1.tar.gz.

File metadata

  • Download URL: photoage-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for photoage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b1ee0e38916b5965f9a2a112fc2e15468aa435add1f1ffe9e9c6951f893d4774
MD5 300eae0e893136ec8fe1008434cf7372
BLAKE2b-256 670e650692962e4329af70a6afbc9ad55505020d7a99356239add52c80515a52

See more details on using hashes here.

File details

Details for the file photoage-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: photoage-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for photoage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85d575c115a9605531b3d93f0e252d6a45e9f5e8ec05a5514b41ae9deb06e5a5
MD5 39f39c922908c8a0646d9b615a05a4c0
BLAKE2b-256 2fdbaa01fd52e69e926f1b805fca6d935b6c41a4b35f9eb426debc2ab9ad832e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page