feat(codecs): add TIFF raster reader and TIFF writer
TiffImageReader decodes strips and tiles (chunky or planar) with none, LZW (old-style bit order tolerated), Deflate, PackBits and JPEG compression (JPEGTables, YCbCr or RGB, lossless SOF3 tiles reshaped as DNG writes them), predictors 2/3 and the DNG x2/x4 variants, 1-16 bit integer and 16/32-bit float samples; tiles decode in parallel. Output is a raw TiffRaster or a linear ImageBuffer. JPEG strips match libtiff bit for bit. TiffWriter writes 8/16-bit gray/RGB/RGBA, uncompressed or Deflate with horizontal predictor, and embeds capture metadata from an Exif block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
10 files changed
+1409
No files matched your search
@@ -44,6 +44,15 @@ public static class JpegDecoder
|
||||
return new JpegRenderer(parser).RenderLinear(expandGray);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a TIFF/DNG tile: lossless streams return raw samples (any component count), DCT streams pixels.</summary>
|
||||
internal static (JpegImage? Image, JpegLosslessImage Raw) DecodeTile(ReadOnlySpan<byte> data, JpegDecodeOptions options)
|
||||
{
|
||||
var parser = Parse(data, options);
|
||||
return parser.Frame!.Process == JpegProcess.Lossless
|
||||
? (null, JpegLosslessDecoder.Finish(parser))
|
||||
: (new JpegRenderer(parser).RenderInterleaved(parser.Info()), default);
|
||||
}
|
||||
|
||||
private static JpegParser Parse(ReadOnlySpan<byte> data, JpegDecodeOptions? options)
|
||||
{
|
||||
var parser = new JpegParser(options ?? JpegDecodeOptions.Default);
|
||||
|
||||
Reference in new issue
Block a user