Numpy <-> Bytes <-> String
Project description
Keyimstr Documentation
[ 1 ] ImageConverter.numpy2bytes(numpy_image, *args, **kwargs) -> bytes
| parameter | data type | default value |
|---|---|---|
| numpy_image | numpy.ndarray | - |
| encoding | str | ".jpg" |
# example 1
from keyimstr import ImageConverter
import numpy
image = numpy.zeros(shape = (25, 25, 3), dtype = numpy.uint8)
print(type(image))
byte = ImageConverter.numpy2bytes(image)
print(type(byte))
[ 2 ] ImageConverter.bytes2string(byte_image, *args, **kwargs) -> str
| parameter | data type | default value |
|---|---|---|
| byte_image | bytes | - |
| encoding | str | "ascii" |
# example 2
from keyimstr import ImageConverter
import numpy
image = numpy.zeros(shape = (25, 25, 3), dtype = numpy.uint8)
print(type(image))
byte = ImageConverter.numpy2bytes(image)
print(type(byte))
string = ImageConverter.bytes2string(byte)
print(type(string))
[ 3 ] ImageConverter.string2bytes(string_image) -> bytes
| parameter | data type | default value |
|---|---|---|
| string_image | str | - |
# example 3
from keyimstr import ImageConverter
import numpy
image = numpy.zeros(shape = (25, 25, 3), dtype = numpy.uint8)
print(type(image))
byte = ImageConverter.numpy2bytes(image)
print(type(byte))
string = ImageConverter.bytes2string(byte)
print(type(string))
byte = ImageConverter.string2bytes(string)
print(type(byte))
[ 4 ] ImageConverter.bytes2numpy(byte_image, *args, **kwargs) -> numpy.ndarray
| parameter | data type | default value |
|---|---|---|
| byte_image | bytes | - |
| np_encoding | int | numpy.uint8 |
| cv_encoding | int | cv2.IMREAD_COLOR |
# example 4
from keyimstr import ImageConverter
import numpy
image = numpy.zeros(shape = (25, 25, 3), dtype = numpy.uint8)
print(type(image))
byte = ImageConverter.numpy2bytes(image)
print(type(byte))
string = ImageConverter.bytes2string(byte)
print(type(string))
byte = ImageConverter.string2bytes(string)
print(type(byte))
image = ImageConverter.bytes2numpy(byte)
print(type(image))
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
Keyimstr-0.0.1.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Keyimstr-0.0.1.tar.gz.
File metadata
- Download URL: Keyimstr-0.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4601384c6fc7d7d42da94e8cc44416853dbd6a1711066c23e7d07bc5dc3f8d52
|
|
| MD5 |
40b7a7405cf08a163a1059cb5e638bd8
|
|
| BLAKE2b-256 |
e6bca7a9eff0013b3fdce2d358a160901b2df388feb07af6ac8188f43c0caa6e
|
File details
Details for the file Keyimstr-0.0.1-py3-none-any.whl.
File metadata
- Download URL: Keyimstr-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94e4b6c925472a55f48855b860f4dddfdb0292bb1f71b6eac638f92ea5893e74
|
|
| MD5 |
c54ea2c5beccfa2fc175fc292fff7e77
|
|
| BLAKE2b-256 |
3ebb7d3e8c92fdd2fd0a68697fba774eb534b580dae5003130f56baf76d64e0e
|