Pyturbojpeg

Latest version: v1.7.3

Safety actively analyzes 638646 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

1.6.6

Added OSX Homebrew lib path for Apple M1 61

1.6.5

1. Improved encode() error handling on wrong array shape (silent crash on wrong array shape (57)
2. Added an extra turbojpeg default path for Mac OS

1.6.4

Fixed lib paths missing on NetBSD 55

1.6.3

scale_with_quality() returns empty data if decoding the image to be scaled triggers a warning. 53

1.6.2

Use libturbojpeg.so instead of libjpeg.so in FreeBSD. 51

1.6.1

Map luminance level to dct coefficient 49

Here is an example to utilize erikogabrielsson his contribution.

python
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)))

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.