I am creating a Python 3 application for steganography, specifically JPEG steganography. For this reason, I have to implement some basic JPEG compression to access the quantized DCT coefficients and embed bits into the LSBs. I have implemented all of this, but now I have a problem with saving the coefficients as a JPEG image.
All of the libraries I have found will perform full JPEG compression when saving an image with the .jpg extension. But I don't want it, as I have already done the lossy parts of the compression myself. I want it to only perform the lossless parts and save the image without performing DCT transformation and quantization on it again.
Has anyone tried to do this before? Are there any libraries out there that let you essentially save a 2 or 3 dimensional numpy.ndarray as a JPEG image without performing lossy compression on it again?
Here is an example of how the transformed, quantized, and embedded coefficients look:
[[[-48. -1. -9.]
[ -3. 0. 1.]
[ 0. -0. -0.]
...
[ 0. -0. 0.]
[ -0. -0. 0.]
[ -0. -0. -0.]]
[[ 3. 0. -2.]
[ -0. -0. 0.]
[ 0. 0. 0.]
...
[ -0. 0. -0.]
[ 0. 0. -0.]
[ -0. -0. 0.]]
[[ -0. 0. 0.]
[ -0. 0. 0.]
[ 0. 0. 0.]
...
[ 0. 0. -0.]
[ -0. 0. 0.]
[ 0. 0. -0.]]]