Skip to main content

Pictures from Google Photos, ICloud, or your Camera... all sorted!

CI codecov.io Language grade: Python Pypi pyversions Code style: black

Installation

Install the library with

pip install sortpics

Main features

  • The library only renames (moves) images. No deletion or copy occurs.
  • When two or more images have identical timestamp at the resolution of a second, the name will include the millisecond.
  • If, despite the above, two files have the same target, only the file with the largest size on disk is moved.
  • Animated movies (joint .JPG/.MOV files) are moved in pair.
  • Custom names are preserved, e.g. My cute cat.jpg is renamed to e.g. 2019-12/2019-12-12 19.06.44 My cute cat.jpg.
  • And, in case you change your mind, sortpics generates a undo script :smiley:

Sample run

Normalize your image collection with

sortpics

in your picture folder. The output will be like this:

mv '2020-05-23/Custom name.jpg' '2020-05/2020-05-23 17.55.43 Custom name.jpg'
mv 2020-05-23/IMG_1554.JPG '2020-05/2020-05-23 16.55.13.JPG'
mv 2020-05-23/IMG_1555.JPG '2020-05/2020-05-23 16.55.43.JPG'
mv 2020-05-23/IMG_1555.MOV '2020-05/2020-05-23 16.55.43.MOV'
mv 2020/05/23/IMG_1556.JPG '2020-05/2020-05-23 18.55.13.123.JPG'
mv 2020/05/23/IMG_1557.JPG '2020-05/2020-05-23 18.55.13.251.JPG'
# Rerun with --no-test to rename the files, or execute 'bash .sortpics_test_2020-05-23T15.16.27.643763.sh'
# Undo the renaming with 'bash .sortpics_undo_test_2020-05-23T15.16.27.643763.sh'
# When you're done, clean up empty directories with 'find . -type d -empty -delete'

Note that the above only proposes a file renaming, and does not move any file at this stage. If you agree with the proposal, you can run the script generated by sortpics, or run sortpics --no-test.

Images and movies are renamed based on their creation date. For instance, an image taken on Dec 25th, 2019 at 15:07:12 will be moved to 2019-12/2019-12-25 15.07.12.jpg.

Useful links

Develop in this package

To develop in this package, clone the project, and then create a dedicated Python environment with

conda env create --file environment.yml

and activate it with

conda activate sortpics

Then install the development version with

pip install -e .

If you want to contribute back** your changes, please install the pre-commit package with

pre-commit install

The tests for this package are in the tests folder, and can be run with

pytest

Metadata

Release files for sortpics 0.1.2

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

Source distribution (sdist)

Source distribution for sortpics 0.1.2
File Size Uploaded
sortpics-0.1.2.tar.gz 9.1 kB Details

Release files / sortpics-0.1.2.tar.gz

Download URL sortpics-0.1.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1901afb956642a04cc55237c0f2867861a3ec1b90e51c4ab2f448e998fb2c5e6
BLAKE2b-256 checksum
How to use checksums
8edc22b385a43feb3e0546b0b9124ba8947abc1e8d2876cf7a2252c92e8507e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0.post20200513 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

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