13

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.

  • 2
    JPEG actually supports 12-bit images! Not very many people know this, and many programs don't support it. But, the support is there. – Dietrich Epp Jul 17 '15 at 22:12
  • 1
    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. – JDługosz Jul 18 '15 at 8:06
  • 1
    BPG supports up tp 14 bits. – Vi0 Jul 18 '15 at 10:39
  • I'm sorry if I'm completely out of line here, but what is wrong with good old ZIP? – Ilia Frenkel Jul 22 '15 at 0:09
  • 1
    @Ilia Frenkel ZIP is not lossy. (Nor specialized for images) – Christopher Bruns Jul 22 '15 at 12:49
18

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.

  • 2
    JPEG2000 seems like just the thing. The ImageMagick tools work with jpeg2000; which is support enough for me to proceed with my investigation. – Christopher Bruns Jul 17 '15 at 17:16
8

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

3

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

  • 1
    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. – junkyardsparkle Jul 17 '15 at 19:12
  • 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. – skyde Aug 22 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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