Open liorbenhorin opened 3 weeks ago
Thanks for reporting this issue.
Unfortunately nvImageCodec currently does not support RGBA format (nvjpeg which we use under the hood also does not support RGBA) and this is what looks is in orig_npy
. We can consider adding RGBA format in future (or at least ignore A if there is 4 color components) but for now definitively we should rather report error and not silently encode and corrupt image.
For now, you can try to remove forth component and pass rgb array
orig_rgb = orig_npy[:,:,:3].copy()
encoder.write("out_as_jpg.jpg",orig_rgb)
Unfortunately in this case there is copy necessary.
Regarding " j2k encoder does not respect quality params" comment, for JPEG 2000 please use target_psnr
instead of quality
Version
0.3.0
Describe the bug.
When encoding an image from an nparray to jpeg - result is incorrect, image is offset to the righ, colors are 'separated'.
The exact image, if saved to jpg to disk (using cv2), and then loaded and encoded - will be saved correctly.
This observation is not happening when using j2k encoder. However, the j2k encoder does not respect quality params (same result for any value)
original image
original image as npy (compressed for security) original_as_npy.zip
incorrect result
Minimum reproducible example
Environment details
Relevant log output
No response
Other/Misc.
No response
Check for duplicates