Skip to main content

Write data to PNG file format

Project description

pngdata

Write data to PNG file format

Installation

python -m pip install pngdata

CLI Usage

Encode

python -m pngdata e <file path> <text to encode>

Decode

python -m pngdata d <file path>

Examples

import pngdata

pngdata.encode('example text', 'example.png')

data = pngdata.decode('example.png')
print(data)  # prints "example text"

# if no fp argument supplied encode returns BytesIO
png_encoded = pngdata.encode('example text')
png_decoded = pngdata.decode(png_encoded)
print(png_decoded)  # prints "example text"

# of course you can save BytesIO to file
with open('bytesio.png', 'wb') as f:
    # seek needed, because png_encoded was read before
    png_encoded.seek(0)
    f.write(png_encoded.read())

data = pngdata.decode('bytesio.png')
print(data)  # prints "example text"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pngdata-1.0.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

pngdata-1.0.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page