PeachImage
PeachImage.Formats.Gif
GifPassthroughInfo Struct
The raw chunk data needed to embed a GIF’s first frame directly into another container (e.g. a PDF
/LZWDecode image stream) without decompressing/recompressing its pixel data. See
TryRead(Stream, GifPassthroughInfo).
public readonly record struct GifPassthroughInfo : System.IEquatable<PeachImage.Formats.Gif.GifPassthroughInfo>
Implements System.IEquatable<GifPassthroughInfo>
| Constructors | |
|---|---|
| GifPassthroughInfo(int, int, int, int, int, int, byte, bool, byte[], Nullable<int>, bool, byte[]) | The raw chunk data needed to embed a GIF’s first frame directly into another container (e.g. a PDF /LZWDecode image stream) without decompressing/recompressing its pixel data. See TryRead(Stream, GifPassthroughInfo). |
| Properties | |
|---|---|
| CanvasHeight | The GIF’s logical screen height, from the header. |
| CanvasWidth | The GIF’s logical screen width, from the header. Compare against Width/Left to detect whether the frame covers the full canvas. |
| Height | The first frame’s Image Descriptor height, in pixels. |
| Interlaced | Whether the frame’s Image Descriptor declares Adam7-style interlacing. GIF’s LZW compresses whatever row order it’s given — interlacing is a row-reordering applied to the pixel indices before compression, not something LZW itself is aware of — so an interlaced frame’s raw LZW bytes decompress into indices in 4-pass order, not top-to-bottom raster order. PDF has no equivalent de-interlace step for image data, so LzwData is not usable for direct PDF embedding when this is true; fall back to a full decode instead. |
| IsAnimated | Whether more than one frame follows in the file. LzwData is still only frame 1’s; PeachImage does not interpret animation frames here. |
| Left | The first frame’s Image Descriptor horizontal offset onto the logical screen. Usually 0, but not guaranteed by the format. |
| LzwData | The frame’s LZW-compressed image data, concatenated from its GIF sub-blocks with the sub-block length-prefix framing already stripped — a continuous LZW bitstream, byte-for-byte as it appears in the file. |
| MinCodeSize | The frame’s LZW minimum code size byte. GIF’s LZW starts codes at MinCodeSize + 1 bits with a Clear code of 1 << MinCodeSize, while PDF’s /LZWDecode filter is fixed at a 9-bit start and Clear code 256 — the two are only byte-for-byte compatible when MinCodeSize == 8. Many real-world small-palette GIFs use a smaller value; passing LzwData through to /LZWDecode for those would silently misinterpret the bitstream from the first code onward. Callers must check this before treating LzwData as PDF-`/LZWDecode`-compatible. |
| Palette | The frame’s effective palette (its Local Color Table if present, else the file’s Global Color Table), as flat RGB triples. |
| Top | The first frame’s Image Descriptor vertical offset onto the logical screen. Usually 0, but not guaranteed by the format. |
| TransparentColorIndex | The frame’s transparent color index from its Graphic Control Extension, or null if none was declared — for building a PDF color-key /Mask. |
| Width | The first frame’s Image Descriptor width, in pixels — what LzwData decompresses to (Width × Height palette-index bytes). |