System::Windows::Media::Imaging::TiffBitmapEncoder does not support Gray32Float Pixelformat

Pierre Chatelier 81 Reputation points
2021-09-03T15:30:57.597+00:00

When using System::Windows::Media::Imaging::TiffBitmapEncoder, it seems that a Gray32Float on input will generate a Gray16 Pixelformat on output, thus losing information.
Is there a workaround ?
It tried to change the Compression property, without any success.

I have a minimal project to reproduce https://chachatelier.fr/tmp/TestWindowsMediaTIFF.zip

[edit]
I would not care if I could avoid reencoding such an image, but I need to edit metadata and I did not find any way to edit metadata in place without decoding first

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,488 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Amin Dodin 1 Reputation point
    2021-10-21T16:01:51.41+00:00

    If you need to properly decode the 32-bit grayscale image without losing any of the gray shades, you can use the LEADTOOLS document imaging SDK. (Disclosure: I work for the SDK’s vendor).

    You can also read and write TIFF tags and comments without decoding or re-encoding the image data itself. This is explained in the .NET tutorial Read and Write TIFF Tags and Comments

    If you would like to try the LEADTOOLS classes, you can download the free evaluation from this page.

    0 comments No comments