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