exif2pandas


Nameexif2pandas JSON
Version 2.1 PyPI version JSON
download
home_pagehttps://github.com/visgean/exif2pandas
SummaryExtract EXIF to pandas / SQL / Excel / Feather
upload_time2024-02-15 13:26:59
maintainer
docs_urlNone
authorVisgean
requires_python
licenseMIT
keywords exif sql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Extract EXIF to pandas / SQL / Excel / Feather

Scans recursively your photo library and extracts EXIF data per file to several data formats.

Extracts:

- file size 
- gps
- Exif data 

Allows export to: 

- Excel
- SQLite
- Feather

and anything else that [Pandas supports](https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html).


## Installation

```
    $ pip3 install exif2pandas --user
```

To export the dataframe you will need one of these modules:

 - SQLite: ``pip3 install --user SQLAlchemy`` 
 - Feather: ``pip3 install --user pyarrow`` 
 - Excel: ``pip3 install --user xlsxwriter``

# Python module usage:

```python
from exif2pandas import extract
from pathlib import Path


df = extract.extract_feather(
    feather_path=Path('photos.feather').resolve(),
    pictures_root=[
        Path('/Users/visgean/Dropbox/Photos').resolve(),
    ],
    processes=5
)


```



# Command line usage:

```
usage: exif2pandas [-h] [-s SQLITE] [-f FEATHER] [-e EXCEL] [-p PROCESSES]
                   picture_folders [picture_folders ...]

Generate sql database with exif data.

positional arguments:
  picture_folders       Folders with the images

optional arguments:
  -h, --help            show this help message and exit
  -s SQLITE, --sqlite SQLITE
                        Output the data frame to SQLite file (this will
                        override existing file!)
  -f FEATHER, --feather FEATHER
                        Output the data frame to feather file (this will
                        override existing file!)
  -e EXCEL, --excel EXCEL
                        Output the data frame to excel (this will override
                        existing file!)
  -p PROCESSES, --processes PROCESSES
                        number of processes to use for collecting exif data,
                        defaults to 5
```

# Example:

```
    $ exif2pandas ~/Dropbox/Photos/ -s ~/photo_metadata.sqlite
```


# Speed

While this is not a benchmark at all, it takes me about 10 seconds to process 123 GB of photos. 
This was taken at my Dell XPS 9570 with Intel® Core™ i7-8750H CPU @ 2.20GHz × 12 CPU using 5 processes.

The resulting file is about 13 MB large.

# Structure

The following is an example of columns that are generated - some cameras might include different fields.

## Custom fields:

- all the columns ending with ``-float`` are evaluated fractions 
- ``cleaned_date`` - this is original date - ignores date set by editors..
- ``cleaned_latitude`` - converted latitude to GPS style, the algorithm is not very precise as far as I know
- ``cleaned_longitude``- longitude
- ``size_megabytes `` - image size in megabytes
- ``filename`` - original filename

## Exif fields:
```
exif-aperturevalue exif-aperturevalue-float exif-bodyserialnumber exif-brightnessvalue 
exif-brightnessvalue-float exif-colorspace exif-componentsconfiguration exif-compressedbitsperpixel 
exif-compressedbitsperpixel-float exif-customrendered exif-datetimedigitized exif-datetimeoriginal 
exif-digitalzoomratio exif-digitalzoomratio-float exif-exifimagelength exif-exifimagewidth 
exif-exifversion exif-exposurebiasvalue exif-exposurebiasvalue-float exif-exposuremode 
exif-exposureprogram exif-exposuretime exif-exposuretime-float exif-filesource exif-flash 
exif-flashpixversion exif-fnumber exif-fnumber-float exif-focallength exif-focallength-float 
exif-focallengthin35mmfilm exif-focalplaneresolutionunit exif-focalplanexresolution 
exif-focalplanexresolution-float exif-focalplaneyresolution exif-focalplaneyresolution-float 
exif-interoperabilityoffset exif-isospeedratings exif-lensmake exif-lensmodel exif-lensserialnumber 
exif-lensspecification exif-lightsource exif-maxaperturevalue exif-maxaperturevalue-float 
exif-meteringmode exif-scenecapturetype exif-scenetype exif-sensingmethod exif-sensitivitytype 
exif-sharpness exif-shutterspeedvalue exif-shutterspeedvalue-float exif-subjectarea 
exif-subjectdistancerange exif-subsectime exif-subsectimedigitized exif-subsectimeoriginal 
exif-usercomment exif-whitebalance
```

## GPS fields

```
gps-gpsaltitude gps-gpsaltitude-float gps-gpsaltituderef gps-gpsdate gps-gpsdestbearing 
gps-gpsdestbearing-float gps-gpsdestbearingref gps-gpsdop gps-gpsdop-float gps-gpsimgdirection 
gps-gpsimgdirection-float gps-gpsimgdirectionref gps-gpslatitude gps-gpslatituderef 
gps-gpslongitude gps-gpslongituderef gps-gpsmapdatum gps-gpsspeed gps-gpsspeed-float 
gps-gpsspeedref gps-gpstimestamp gps-gpsversionid
```

## Image Fields:

```
image-artist image-cfapattern image-cfarepeatpatterndim image-copyright image-datetime 
image-datetimeoriginal image-documentname image-exifoffset image-exposuretime 
image-exposuretime-float image-fnumber image-fnumber-float image-focallength 
image-focallength-float image-gpsinfo image-imagelength image-imagewidth 
image-isospeedratings image-make image-model image-orientation image-rating 
image-resolutionunit image-sampleformat image-software image-subfiletype 
image-xresolution image-xresolution-float image-ycbcrpositioning 
image-yresolution-float image-yresolution
```

# Other fields

```
interoperability-interoperabilityindex interoperability-interoperabilityversion
makernote-afpointset makernote-blurwarning makernote-colortemperature makernote-exposurecount
makernote-exposurewarning makernote-flashmode makernote-flashstrength 
makernote-flashstrength-float makernote-focusmode makernote-focuspixel 
makernote-focuswarning makernote-hdrimagetype makernote-motororbracket 
makernote-noteversion makernote-picturemode makernote-quality makernote-saturation 
makernote-sharpness makernote-slowsync makernote-whitebalance makernote-whitebalancefinetune 
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/visgean/exif2pandas",
    "name": "exif2pandas",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "exif sql",
    "author": "Visgean",
    "author_email": "visgean@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/84/f1266c99a3364ddfd0a4b653d8e3b691ff8cb064ca276a8baeb26fff8e91/exif2pandas-2.1.tar.gz",
    "platform": null,
    "description": "# Extract EXIF to pandas / SQL / Excel / Feather\n\nScans recursively your photo library and extracts EXIF data per file to several data formats.\n\nExtracts:\n\n- file size \n- gps\n- Exif data \n\nAllows export to: \n\n- Excel\n- SQLite\n- Feather\n\nand anything else that [Pandas supports](https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html).\n\n\n## Installation\n\n```\n    $ pip3 install exif2pandas --user\n```\n\nTo export the dataframe you will need one of these modules:\n\n - SQLite: ``pip3 install --user SQLAlchemy`` \n - Feather: ``pip3 install --user pyarrow`` \n - Excel: ``pip3 install --user xlsxwriter``\n\n# Python module usage:\n\n```python\nfrom exif2pandas import extract\nfrom pathlib import Path\n\n\ndf = extract.extract_feather(\n    feather_path=Path('photos.feather').resolve(),\n    pictures_root=[\n        Path('/Users/visgean/Dropbox/Photos').resolve(),\n    ],\n    processes=5\n)\n\n\n```\n\n\n\n# Command line usage:\n\n```\nusage: exif2pandas [-h] [-s SQLITE] [-f FEATHER] [-e EXCEL] [-p PROCESSES]\n                   picture_folders [picture_folders ...]\n\nGenerate sql database with exif data.\n\npositional arguments:\n  picture_folders       Folders with the images\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -s SQLITE, --sqlite SQLITE\n                        Output the data frame to SQLite file (this will\n                        override existing file!)\n  -f FEATHER, --feather FEATHER\n                        Output the data frame to feather file (this will\n                        override existing file!)\n  -e EXCEL, --excel EXCEL\n                        Output the data frame to excel (this will override\n                        existing file!)\n  -p PROCESSES, --processes PROCESSES\n                        number of processes to use for collecting exif data,\n                        defaults to 5\n```\n\n# Example:\n\n```\n    $ exif2pandas ~/Dropbox/Photos/ -s ~/photo_metadata.sqlite\n```\n\n\n# Speed\n\nWhile this is not a benchmark at all, it takes me about 10 seconds to process 123 GB of photos. \nThis was taken at my Dell XPS 9570 with Intel\u00ae Core\u2122 i7-8750H CPU @ 2.20GHz \u00d7 12 CPU using 5 processes.\n\nThe resulting file is about 13 MB large.\n\n# Structure\n\nThe following is an example of columns that are generated - some cameras might include different fields.\n\n## Custom fields:\n\n- all the columns ending with ``-float`` are evaluated fractions \n- ``cleaned_date`` - this is original date - ignores date set by editors..\n- ``cleaned_latitude`` - converted latitude to GPS style, the algorithm is not very precise as far as I know\n- ``cleaned_longitude``- longitude\n- ``size_megabytes `` - image size in megabytes\n- ``filename`` - original filename\n\n## Exif fields:\n```\nexif-aperturevalue exif-aperturevalue-float exif-bodyserialnumber exif-brightnessvalue \nexif-brightnessvalue-float exif-colorspace exif-componentsconfiguration exif-compressedbitsperpixel \nexif-compressedbitsperpixel-float exif-customrendered exif-datetimedigitized exif-datetimeoriginal \nexif-digitalzoomratio exif-digitalzoomratio-float exif-exifimagelength exif-exifimagewidth \nexif-exifversion exif-exposurebiasvalue exif-exposurebiasvalue-float exif-exposuremode \nexif-exposureprogram exif-exposuretime exif-exposuretime-float exif-filesource exif-flash \nexif-flashpixversion exif-fnumber exif-fnumber-float exif-focallength exif-focallength-float \nexif-focallengthin35mmfilm exif-focalplaneresolutionunit exif-focalplanexresolution \nexif-focalplanexresolution-float exif-focalplaneyresolution exif-focalplaneyresolution-float \nexif-interoperabilityoffset exif-isospeedratings exif-lensmake exif-lensmodel exif-lensserialnumber \nexif-lensspecification exif-lightsource exif-maxaperturevalue exif-maxaperturevalue-float \nexif-meteringmode exif-scenecapturetype exif-scenetype exif-sensingmethod exif-sensitivitytype \nexif-sharpness exif-shutterspeedvalue exif-shutterspeedvalue-float exif-subjectarea \nexif-subjectdistancerange exif-subsectime exif-subsectimedigitized exif-subsectimeoriginal \nexif-usercomment exif-whitebalance\n```\n\n## GPS fields\n\n```\ngps-gpsaltitude gps-gpsaltitude-float gps-gpsaltituderef gps-gpsdate gps-gpsdestbearing \ngps-gpsdestbearing-float gps-gpsdestbearingref gps-gpsdop gps-gpsdop-float gps-gpsimgdirection \ngps-gpsimgdirection-float gps-gpsimgdirectionref gps-gpslatitude gps-gpslatituderef \ngps-gpslongitude gps-gpslongituderef gps-gpsmapdatum gps-gpsspeed gps-gpsspeed-float \ngps-gpsspeedref gps-gpstimestamp gps-gpsversionid\n```\n\n## Image Fields:\n\n```\nimage-artist image-cfapattern image-cfarepeatpatterndim image-copyright image-datetime \nimage-datetimeoriginal image-documentname image-exifoffset image-exposuretime \nimage-exposuretime-float image-fnumber image-fnumber-float image-focallength \nimage-focallength-float image-gpsinfo image-imagelength image-imagewidth \nimage-isospeedratings image-make image-model image-orientation image-rating \nimage-resolutionunit image-sampleformat image-software image-subfiletype \nimage-xresolution image-xresolution-float image-ycbcrpositioning \nimage-yresolution-float image-yresolution\n```\n\n# Other fields\n\n```\ninteroperability-interoperabilityindex interoperability-interoperabilityversion\nmakernote-afpointset makernote-blurwarning makernote-colortemperature makernote-exposurecount\nmakernote-exposurewarning makernote-flashmode makernote-flashstrength \nmakernote-flashstrength-float makernote-focusmode makernote-focuspixel \nmakernote-focuswarning makernote-hdrimagetype makernote-motororbracket \nmakernote-noteversion makernote-picturemode makernote-quality makernote-saturation \nmakernote-sharpness makernote-slowsync makernote-whitebalance makernote-whitebalancefinetune \n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Extract EXIF to pandas / SQL / Excel / Feather",
    "version": "2.1",
    "project_urls": {
        "Homepage": "https://github.com/visgean/exif2pandas"
    },
    "split_keywords": [
        "exif",
        "sql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3384f1266c99a3364ddfd0a4b653d8e3b691ff8cb064ca276a8baeb26fff8e91",
                "md5": "f7a6aaacd7413a119ac22941ed1a8b18",
                "sha256": "28e08c486e6c903f822aace83ebd14b9d8725d566fba80d88aa755413df83bc1"
            },
            "downloads": -1,
            "filename": "exif2pandas-2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f7a6aaacd7413a119ac22941ed1a8b18",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7616,
            "upload_time": "2024-02-15T13:26:59",
            "upload_time_iso_8601": "2024-02-15T13:26:59.535467Z",
            "url": "https://files.pythonhosted.org/packages/33/84/f1266c99a3364ddfd0a4b653d8e3b691ff8cb064ca276a8baeb26fff8e91/exif2pandas-2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-15 13:26:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "visgean",
    "github_project": "exif2pandas",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "exif2pandas"
}
        
Elapsed time: 0.18576s