[x] I have written a descriptive pull-request title
[x] I have verified that there are no overlapping pull-requests open
[x] I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
[x] I have provided test coverage for my change (where applicable)
Description
[x] Decode multiframe Tiff of different size.
[x] Encode multiframe Tiff of different size.
[ ] Trim transparent pixels on image save?
See the discussion in #1982
Decoding is fairly trivial. We just needed to pass the correct parameters to the various internal types and draw to frames matching the root frame dimensions.
I don't know whether it is actually possible to trim transparent pixels on encode as there's no guarantee that the pixel format we have decoded to supports transparency. I guess we could add some sort of ChromaKeyColor property to the encoder and trim any bounding pixels matching that value?
I'll likely need assistance writing a performant trimming algorithm (My SIMD is rusty)
I've actually figured out a very neat way to handle all this transparently:
First off, we track the encoded dimensions in the same manner as ICO and CUR formats that ensures the frames are encoded at a configurable size.
By adding handling methods to the metadata APIs that run after processing a transformed image we can then automatically update those properties to scale with the transform. This mean you can load a Tiff Mipmap, resize the image and save each frame encoding only the relevant data!! 😄
In addition, I've normalized the ImageFrame.Size() method to now match the Image.Size property.
Prerequisites
Description
Trim transparent pixels on image save?See the discussion in #1982 Decoding is fairly trivial. We just needed to pass the correct parameters to the various internal types and draw to frames matching the root frame dimensions.
I don't know whether it is actually possible to trim transparent pixels on encode as there's no guarantee that the pixel format we have decoded to supports transparency. I guess we could add some sort ofChromaKeyColor
property to the encoder and trim any bounding pixels matching that value?I'll likely need assistance writing a performant trimming algorithm (My SIMD is rusty)
I've actually figured out a very neat way to handle all this transparently:
First off, we track the encoded dimensions in the same manner as ICO and CUR formats that ensures the frames are encoded at a configurable size.
By adding handling methods to the metadata APIs that run after processing a transformed image we can then automatically update those properties to scale with the transform. This mean you can load a Tiff Mipmap, resize the image and save each frame encoding only the relevant data!! 😄
In addition, I've normalized the
ImageFrame.Size()
method to now match theImage.Size
property.