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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file pngdata-1.0.0.tar.gz
.
File metadata
- Download URL: pngdata-1.0.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb23a5c8941bd219fda5b8e9c369a7111024d38b8e63666d9990565bc3fa313 |
|
MD5 | f814069b20af17b238b2282ad73b9d60 |
|
BLAKE2b-256 | b4b1a138ea8911228af6c4b10bdb4a21043a52c2fc7671485202b940610cd046 |
File details
Details for the file pngdata-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pngdata-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffd39c53d150ca7b7d5ef5cb169cb1859c61b0ac63675369986be8884322dc95 |
|
MD5 | 4beb46ecfa511dfb510b006adb8c6e4d |
|
BLAKE2b-256 | 29e584ab72c2de81fbf725a83d9376572fb9eef9615ca4f407df8b6b5cf5fc57 |