statistics about your photographic habits
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
René Wagner 36fe991fa1 fix uninitialized when not filtering 11 months ago
.build.yml use Modern::Perl for convenience 11 months ago
.gitignore improve formatting of focallength 12 months ago
LICENSE setup build and packaging 1 year ago
PKGBUILD update PKGBUILD for auto-update version 1 year ago
README.md reformat output for timerange filters 11 months ago
phosta.pl fix uninitialized when not filtering 11 months ago

README.md

Photo Stats

builds.sr.ht status

This project is a small statistic generator for the terminal which accumulates about your photographical habits.

It is mainly a selfcontained SQlite database that stores the data which is extracted from the exif data of your images using exiftool and provides some methods to query the gathered data and gain some statistical insight.

Additional information can be found on the wiki page.

requirements

The famous exiftool needs to be installed on your system, no matter if you use prebuilt binarys or the bare scripts.

There are prebuilt binarys (currently only x86_64 for linux and Haiku) and packages for Arch Linux and derivatives available for every ref.

using bare scripts

Simply clone the repo or manually download the scripts from https://git.sr.ht/~rwa/photo-stats/

To run the script, open a shell and invoke perl phosta.pl, on most systems it should be sufficient to just invoke phosta.pl (after you granted execute-permissions to the script).

prerequisites for running the pure scripts

  • Perl 5.30 (or newer)

Additionally the following perl modules need to be installed:

  • Cwd
  • File::HomeDir
  • File::Spec::Functions
  • Perl::DBD::SQLite
  • Perl::DBI
  • Text::SimpleTable::AutoWidth

features

  • loading of EXIF data from media files to a self-contained database
  • querying different statistics from the gathered data
  • available fields
    • camera maker
    • camera model (body)
    • lens model
    • focal length
    • iso
    • aperture
  • grouping with summarizing based on date&time of pictures
    • year
    • month
    • week
    • hour
  • filtering of data by
    • time range of photos shot
    • values in fields in "CONTAINS" and "NOT CONTAINS" mode
  • custom sorting of output by arbitrary fields
  • output results in a table view to your terminal

example output

Querying database ~/photos.db with 82 entries...

.-----------------+-------+---------.
| model           | count | percent |
+-----------------+-------+---------+
| SM-A320FL       | 31    | 37.8%   |
| Nokia 2.2       | 18    | 22.0%   |
| XF10            | 15    | 18.3%   |
| -               | 9     | 11.0%   |
| STH100-2        | 3     | 3.7%    |
| iPhone SE       | 1     | 1.2%    |
| PENTAX KP       | 1     | 1.2%    |
| PENTAX K-5 II s | 1     | 1.2%    |
| PENTAX K-3 II   | 1     | 1.2%    |
| PENTAX K-01     | 1     | 1.2%    |
| GR II           | 1     | 1.2%    |
'-----------------+-------+---------'

usage

Before you can query some stats, the EXIF data has to be extracted from your media files and written to the database. For available params and examples see the listing below.

You can add different folders one by another to the database, the import will take care the files added and avoid duplicates (currently based on file path). If you think something is messed up you can clean your database and start over.

After you've added some data, you can query different statistics which might be interesting. There are no predefined stats, instead you have the option to adjust the output to your needs using the different params listed below. More sophisticated filters (based on selected fields or file path) may come later.

usage: phosta(.pl) [options]

generic options:
   -D <file>   : path and name of the db file to use, defaults to <workingdir>/photo_stats.db
                 This option is automatically saved in the user conf, you can omit this option if you always use the same db
   -c          : clear the database
   -v          : be verbose - print some debug output
   --help      : show this help

data gathering:
   -p <folder> : populate database from the files in the specified folder
                 Media files in the given folder and every subfolder are scanned, EXIF data extracted and pulled into the database
   -E <ext>    : list of comma separated extensions used for scanning image files, defaults to jpg,jpeg
                 only media files which match (case-insensitive!) the given extensions are added to the database
                 This option is saved to the user conf

stats querying:
   -g <period> : group by a time period, defaults to total (which means no grouping by period)
                 allowed values: year, month, week, hour
   -s <fields> : specify the information you want to select, defaults to none (just show number of images)
                 allowed values: maker, model, lensmake, lens, aperture, exposuretime, iso, focallength, focallength35mm
                 multiple fields should be listed comma-separated
   -t <range>  : only take images into account which have been taken in the given timerange
                 <range> must be specified as 'YYYYMMDD-YYYYMMDD', you can omit one value
   -f <expr>   : filter images based on the given expression, multiple expression can be given comma-separated
                 this works as a case-insensitive CONTAINS search, multiple expressions need to match all (AND logic)
                 use "field=value" for CONTAINS and "field!=value" for NOT CONTAINS, value must not include whitespaces
                 allowed fields: file, maker, model, lensmake, lens, aperture, exposuretime, iso, focallength, focallength35mm
   -n <number> : limit the resultset to <number> of lines
   -o <fields> : sort your output by the given fields (sequence matters!) in descending order
                 allowed values: any comma separated combination of the values of -t and -s param and 'count'
   -r          : sort in reverse (ascending) order

examples:
   phosta -E jpg,jpeg,tiff -D ~/Documents/stats.db -p ~/Pictures
   load EXIF data of files with the extensions jpg, jpeg and tiff in folder ~/Pictures to the database located in ~/Documents/stats.db

   phosta -s model -g month -t 20190101-20121231 -o month,count
   show number of pictures taken in with a specific camera body in 2019 grouped by month, sorted by newest month first

   phosta -n 10 -s lens -o count
   show top 10 lenses used the most

   phosta -s model -f maker!=ricoh
   show camera models where the maker field does not contain the term "ricoh"