Skip to main content

PicDate: Quick and Simple Date Marking for Photos

Project description

PicDate: Quick and Simple Date Marking for Photos

PyPI PyPI Downloads GitHub license Coding style

Description

Photo studios no longer offer the service of adding dates to photos, so if you need it, you have to do it yourself. Since there didn't seem to be any tools for this, I created one. The format and style are almost fully controlled by users. The DateTimeOriginal, i.e., the date the photo was taken, is added if the exif information exists; otherwise, stat.ST_MTIME, the time of last modification, is used for those photo without exif information. Note that ST_MTIME is just close to but not the taken time. The image qualities are different after processed due to Pillow tool.

Install

from PyPi:

pip3 install picdate
# or with specific version
pip3 install picdate==2.0.1

from GitHub:

pip3 install git+https://github.com/aben20807/picdate.git
# or with specific version
pip3 install git+https://github.com/aben20807/picdate.git@v2.0.1

Usage

picdate -s 20221012/ -r

After processing, a folder named picdate_result will be created, containing the processed files.

Screenshot

DSC_0005

Font

Performance

  • 360 photos (1.72 GB) -> 360 photos with dates (1.31 GB): 5.967s

Help

$ picdate -h
usage: picdate [-h] -s DIR [-d DIR] [-f] [-r] [-j N] [--text_size N]
               [--text_color COLOR] [--text_anchor TEXT_ANCHOR] [--pos_x X]
               [--pos_y Y] [--fine_tune_aspect_ratio RATIO] [--stroke_width N]
               [--stroke_color COLOR] [--quality N] [--resize W,H]
               [--format FORMAT] [--img_exts IMG_EXTS]

PicDate: Quick and Simple Date Marking for Photos

options:
  -h, --help            show this help message and exit
  -s DIR, --src DIR     input dir (required) (default: None)
  -d DIR, --dst DIR     output dir (default: ./picdate_result/)
  -f, --force           overwrite existing files (default: False)
  -r, --recursive       recursively process (default: False)
  -j N, --jobs N        parallel jobs to process (default: 16)
  --text_size N         text size ('N' mm) (default: 4.24)
  --text_color COLOR    text color (default: (255, 149, 21))
  --text_anchor TEXT_ANCHOR
                        text anchor (ref:
                        https://pillow.readthedocs.io/en/stable/handbook/text-
                        anchors.html#text-anchors) (default: rb)
  --pos_x X             position for x-axis from 0 (left) to 1 (right) (default:
                        0.94)
  --pos_y Y             position for y-axis from 0 (top) to 1 (bottom) (default:
                        0.94)
  --fine_tune_aspect_ratio RATIO
                        expect aspect ratio for fine tune pos for cropping
                        ('none' or 'M/N' (M<=N)) (default: 2/3)
  --stroke_width N      stroke width for text (default: 1)
  --stroke_color COLOR  stroke color (default: (242, 97, 0))
  --quality N           jpg output quality (default: 95)
  --resize W,H          resize image to WxH (default: None)
  --format FORMAT       date format (ref: https://docs.python.org/3/library/date
                        time.html#strftime-and-strptime-format-codes) (default:
                        `%y %#m %#d)
  --img_exts IMG_EXTS   support extensions for processed photos (case
                        insensitive) (default: jpg,jpeg,png,tiff)

Known issues

  • strftime exhibits different behavior across platforms, leading to invalid format strings. The current implementation detects the platform and applies a different default format: windows (`%y %#m %#d) and others (`%y %-m %-d).

License

MIT

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

picdate-2.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picdate-2.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file picdate-2.1.0.tar.gz.

File metadata

  • Download URL: picdate-2.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for picdate-2.1.0.tar.gz
Algorithm Hash digest
SHA256 f425cb422b0235afa0a11251ee89ea27a9571d2ef95880f7d72ab678fc1f60de
MD5 ce209e2b363853b616daaf45423d4734
BLAKE2b-256 3eabc9b60f05ddb9b276d54c79e5041c3e4db9c8b04b6e108f116b1c45102fda

See more details on using hashes here.

Provenance

The following attestation bundles were made for picdate-2.1.0.tar.gz:

Publisher: publish-to-pypi.yml on aben20807/picdate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file picdate-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: picdate-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for picdate-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66fbd96d82bcff6d33bf3c9289e3e0e1fc0bf582c645526583a9ca3c2acdc7d9
MD5 6b796b28171df1611850d4b3e9ed3566
BLAKE2b-256 be29c51b1a6cac928e7408e4d53c2c789ff884173349b41bb92cdaec52ff1fb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for picdate-2.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on aben20807/picdate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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