Releases: lilohuang/PyTurboJPEG
Releases · lilohuang/PyTurboJPEG
Improved encode() error handling on wrong array shape
- Improved encode() error handling on wrong array shape (silent crash on wrong array shape (#57)
- Added an extra turbojpeg default path for Mac OS
Fixed lib paths missing on NetBSD
Fixed lib paths missing on NetBSD #55
fix incorrect logic on scale_with_quality()
scale_with_quality() returns empty data if decoding the image to be scaled triggers a warning. #53
Use libturbojpeg.so instead of libjpeg.so in FreeBSD.
Use libturbojpeg.so instead of libjpeg.so in FreeBSD. #51
v1.6.1
Map luminance level to dct coefficient #49
Here is an example to utilize @erikogabrielsson his contribution.
from PIL import Image
import numpy as np
import io
from turbojpeg import TurboJPEG
jpeg = TurboJPEG(r'C:\libjpeg-turbo64\bin\turbojpeg.dll')
in_file_path = r'in-1024x1024.jpeg'
in_file = open(in_file_path, 'rb')
in_data = in_file.read()
in_file.close()
# Crop the image to a larger size, fill extended area with white (1).
out_data = jpeg.crop_multiple(in_data, [(0, 0, 2048, 2048)], 1)[0]
# Write to file for analysis.
out_filepath = r'out.jpeg'
out_file = open(out_filepath, 'wb')
out_file.write(out_data)
out_file.close()
# Quick check that the end of the image array is RGB 255, 255, 255
np.asarray(Image.open(io.BytesIO(out_data)))
Support for multiple crop and fill background
crop_multiple() has been added to support for multiple crop and fill background #48
Add FreeBSD search path to avoid KeyError.
Add FreeBSD search path to avoid KeyError. #47
Add default path to library in openSUSE systems
Add default path to library in openSUSE systems #45
Modify encode function to support 1-channel input
Modify encode function to support 1-channel input #42
Adding more code examples
Adding more code examples,
- decoding input.jpg to BGR array with fast upsample and fast DCT. (i.e. fastest speed but lower accuracy)
- using PyTurboJPEG with ExifRead to transpose an image if the image has an EXIF Orientation tag