Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Exposing the OpenJPEG sgnd parameter when JPEG2000 encoding

Open scaramallion opened this issue 4 years ago • 0 comments

I'd like to be able to perform JPEG2K encoding of medical images using Pillow, particularly 16-bit signed greyscale (commonly used with CT and MR). Because of the limited supported modes in Jpeg2KEncode.c this is not currently possible as all input data is treated as unsigned.

Would it be acceptable if I provided a PR exposing the sgnd compression parameter to end users when saving? I ask because it feels more like a workaround than a true solution. Ideally I'd add support for I mode but OpenJPEG only supports a maximum of 31 bit samples.

scaramallion avatar May 17 '21 01:05 scaramallion