nvjpeg for python
Project description
NvJpeg - Python
Require
- nvjpeg
- cuda >= 10.2
- numpy >= 1.7
- python >= 3.6
- gcc >= 7.5
- make >= 4.1
Install
pip install pynvjpeg
Usage
#!/usr/bin/env python3
from nvjpeg import NvJpeg
# read file
fp = open("input-image.jpg", "rb")
jpegData = fp.read()
fp.close()
# decode
nj = NvJpeg()
img_np = nj.decode(jpegData)
# use opencv show numpy image data
cv2.imshow("Demo", img_np)
cv2.waitKey(0)
# encode numpy image data
jpg = nj.encode(img_np)
# write file
fp = open("output-image.jpg", "wb")
fp.write(jpg)
fp.close()
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
pynvjpeg-0.0.6.tar.gz
(5.0 kB
view hashes)