Metadata-Version: 2.2
Name: picdate
Version: 2.1.0
Summary: PicDate: Quick and Simple Date Marking for Photos
Author-email: Po-Hsuan Huang <aben20807@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Huang, Po-Hsuan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
        the Software, and to permit persons to whom the Software is furnished to do so,
        subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
        FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
        IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
        CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/aben20807/picdate
Project-URL: Bug Tracker, https://github.com/aben20807/picdate/issues
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pillow

# PicDate: Quick and Simple Date Marking for Photos

[![PyPI](https://img.shields.io/pypi/v/picdate?color=blue&style=flat&logo=pypi)](https://pypi.org/project/picdate/) [![PyPI Downloads](https://static.pepy.tech/badge/picdate)](https://pepy.tech/projects/picdate) [![GitHub license](https://img.shields.io/github/license/aben20807/picdate?color=blue)](LICENSE) [![Coding style](https://img.shields.io/badge/code%20style-black-1183C3.svg)](https://github.com/psf/black)

## 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`](https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif/datetimeoriginal.html), i.e., the date the photo was taken, is added if the exif information exists; otherwise, [`stat.ST_MTIME`](https://docs.python.org/3/library/stat.html#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:

```bash
pip3 install picdate
```

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

from GitHub:

```bash
pip3 install git+https://github.com/aben20807/picdate.git
```

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

## Usage

```bash
picdate -s 20221012/ -r
```

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

## Screenshot

![DSC_0005](https://user-images.githubusercontent.com/14831545/207787756-1e98292a-2e5a-4fdb-9db4-1dbe9aad7227.JPG)

## Font

+ [CursedTimerUlil-Aznm.ttf](https://www.fontspace.com/cursed-timer-ulil-font-f29411): designed by [heaven castro](https://www.fontspace.com/heaven-castro) and licensed as Freeware

## Performance

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

## Help

```bash
$ 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
