Skip to main content

A easy class for save the data by the img

Project description

ImData

Author: Jeef
Email: jeefy163@163.com


Installation

Use git to clone it for the github.com.
See Github
Or see PyPI to install
pip install imdata.


Usage

the main class is ImData.
Dependeces: imageio
Advice: Use python that later than 3.5, no support for 2.7

Imdata.bytes_pix(bs, size, encode='utf-8')

if bs is a string, use 'encode' to encode the string.
size is the size of the img, such as (40, 80).
size is not for the length of the bs, it's about 1.4 bigger than the length.
for eample, if bytes is like b'my bytes', size at least should be (3,4) instead of (2,4)

ImData.pix_bytes(pix, encode='utf-8')

The pix is the np.array object. Use import numpy as np; pix = np.array(...).
encode for the bytes type, is want a string.

ImData.read(uri)

Read from the image, notice that do not read a unsupport picture.

ImData.save(uri, bytes=None, size, format)

Save the bytes to the image.
format can only be in 'tif', 'tiff', 'png' but not for 'jpg', 'jpeg', 'gif' and so on.

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

imdata-0.0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

imdata-0.0.1-py3-none-any.whl (2.9 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