/nsipptparser

Very simple Python package to parse .nsippt files to json

Primary LanguagePythonMIT LicenseMIT

nsipptparser

Latest PyPI version Latest Travis CI build status

Very simple package for parsing .nsippt files to json. Use Python 3.4 and up.

.nsippt files are a file type by North Star Imaging.

Installation

pip install nsipptparser

Usage

import nsipptparser
import json

with open("sneaky.nsippt") as file:
    data = nsipptparser.parse(file)
    # Get the first length measurement of the first View
    length = data["ViewPropertiesSet"]["View Properties"][0]["Actions Set"]["Length"][0]["length value"]
    print("The length is ", length)

    # Get the base64 thumbnail of the first View
    thumbnail = data["ViewPropertiesSet"]["View Properties"][0]["Thumbnail"]
    print("The thumbnail is ", thumbnail)

    # Save to json file
    with open('data.json', 'w') as f:
        json.dump(data, f, indent=4)

Note: All values are parsed as strings, so you will have to parse the strings further yourself.

You can probably use pillow to convert the base64 thumbnail to an image:

./example/thumbnail.jpg

Compatibility

Known to work on Python 3.7

Licence

MIT

Authors

nsipptparser was written by Russell Tran.