I have encountered a strange behavior of TransformedBitmap
.
A 16-bit grayscale TIFF image (PixelFormats.Gray16) loads just fine into a BitmapSource, but when the image is scaled using TransformedBitmap containing scaling transform, WIC changes pixel format to PixelFormats.Gray32Float and the image gets darker.
Here is the original BitmapSource and the TransformedBitmap:
My clue is that WIC for some reason applies gamma correction to the second image, but the documentation says both Gray16 and Gray32Float use gamma of 1.0 so there should be no gamma conversion at all.
Is this a bug in WIC? Is there any way to workaround for TransformedBitmap modifying content of my images?