Browse Source

Ensure palette is always captured.

pull/3055/head
James Jackson-South 6 months ago
parent
commit
c43b6365d0
  1. 19
      src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

19
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

@ -584,6 +584,15 @@ internal class TiffDecoderCore : ImageDecoderCore
}
}
{
// If the color decoder is the palette decoder we need to capture its palette.
if (colorDecoder is PaletteTiffColor<TPixel> paletteDecoder)
{
TiffFrameMetadata tiffFrameMetadata = frame.Metadata.GetTiffMetadata();
tiffFrameMetadata.LocalColorTable = paletteDecoder.PaletteColors;
}
}
return;
}
@ -621,11 +630,13 @@ internal class TiffDecoderCore : ImageDecoderCore
colorDecoder.Decode(stripBufferSpan, pixels, 0, top, width, stripHeight);
}
// If the color decoder is the palette decoder we need to capture its palette.
if (colorDecoder is PaletteTiffColor<TPixel> paletteDecoder)
{
TiffFrameMetadata tiffFrameMetadata = frame.Metadata.GetTiffMetadata();
tiffFrameMetadata.LocalColorTable = paletteDecoder.PaletteColors;
// If the color decoder is the palette decoder we need to capture its palette.
if (colorDecoder is PaletteTiffColor<TPixel> paletteDecoder)
{
TiffFrameMetadata tiffFrameMetadata = frame.Metadata.GetTiffMetadata();
tiffFrameMetadata.LocalColorTable = paletteDecoder.PaletteColors;
}
}
}

Loading…
Cancel
Save