15
\$\begingroup\$

I'd like to aggressively compress some scientific 16-bit grayscale image files, but without reducing the dynamic range. Is such a thing possible?

I understand that JPEG format uses lossy, and therefore tunably aggressive, compression, but only supports 8-bits per color channel.

PNG format supports 16-bit grayscale images, but only supports lossless compression, which limits the file compression ratio.

TIFF format also supports 16-bit grayscale images, but as far as I am aware, supports no standard lossy compression of 16-bit images.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ JPEG actually supports 12-bit images! Not very many people know this, and many programs don't support it. But, the support is there. \$\endgroup\$ Jul 17, 2015 at 22:12
  • 1
    \$\begingroup\$ I think openEXR is what you want. You can be more flexible with color subsampling than jpeg, and tune it better for your scientific data needs. As I recall, this is developed for/by Pixar. \$\endgroup\$
    – JDługosz
    Jul 18, 2015 at 8:06
  • 2
    \$\begingroup\$ BPG supports up tp 14 bits. \$\endgroup\$
    – Vi0
    Jul 18, 2015 at 10:39
  • \$\begingroup\$ I'm sorry if I'm completely out of line here, but what is wrong with good old ZIP? \$\endgroup\$ Jul 22, 2015 at 0:09
  • 1
    \$\begingroup\$ @Ilia Frenkel ZIP is not lossy. (Nor specialized for images) \$\endgroup\$ Jul 22, 2015 at 12:49

3 Answers 3

18
\$\begingroup\$

It sounds like what you're looking for is JPEG2000. It has a range of options including a 16-bit lossy compression and better compression ratios than JPEG. It hasn't been as widely adopted as hoped (for a host of reasons) and may have some patent issues that might make it difficult to use in certain situations but otherwise it fits your needs.

Personally if I were in your position I'd say storage is cheap and use PNG which is a properly defined and free standard.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ JPEG2000 seems like just the thing. The ImageMagick tools work with jpeg2000; which is support enough for me to proceed with my investigation. \$\endgroup\$ Jul 17, 2015 at 17:16
8
\$\begingroup\$

JPEG2000, and you may also want to look at OpenEXR because it is supported by video hardware.

\$\endgroup\$
3
\$\begingroup\$

The maximum dynamic range of a linear 8-bit encoding is only 8 stops, however the dynamic range you can store with a nonlinear encoding is limitless.

Thus I would suggest you apply a strong tonecurve to the images and then you can use standard JPEG without losing dynamic range. When you want to use the original images, convert them to 16-bit and apply the inverse tonecurve.

That is of course if dynamic range is your only concern. If you also need to preserve tonal range then you might have to roll your own lossy compression...

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Similarly, you could pre-process the images in ways that discard the information that you know you don't care about, prior to saving as losslessly compressed 16-bit PNG or TIFF. \$\endgroup\$ Jul 17, 2015 at 19:12
  • \$\begingroup\$ This is what video camera are doing with log picture profile but from experience I can say it’s a very bad bad idea because the reduction in information is fixed instead of using variable lossiness. Using openEXR lossy compression would give much better result. \$\endgroup\$
    – skyde
    Aug 22, 2018 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.