tiff_io library

Optional file-based decoding entry point.

Uses dart:io, so it's not available on web — kept separate from package:tiff/tiff.dart so the core library stays platform-agnostic. Import this in addition when you want to decode straight from a File without loading it fully into memory (the point of BigTIFF).

Classes

FileByteSource
A TiffByteSource backed by a file on disk, read on demand via RandomAccessFile instead of loading the whole file into memory — the point of BigTIFF, which exists for multi-gigabyte files.
SystemMemoryInfo
A best-effort snapshot of the machine's total and currently-available physical memory, probed by shelling out to a short OS command (Process.runSync) — there is no portable Dart/dart:io API for this, and no reading at all is possible on a sandboxed mobile OS (iOS/Android don't expose system-wide memory to an app, and Process itself isn't available there).
TiffAutoDecodeBudget
Picks a (maxBytesPerChunk, workerCount) pair for TiffParallelDecoder.decodeBanded sized to both metadata and the machine actually running it — the pairing TiffChunkPlan and TiffChunkPlan.recommendedWorkerCount need a caller to already know (see their own doc comments on why neither reads OS/CPU state itself). Without this, a caller either hardcodes a number that's far too small for a big multi-core machine with memory to spare, or far too large for a small one — recommend instead reads what's actually idle right now (SystemMemoryInfo.probe, Platform.numberOfProcessors) and sizes to that, per call, so the same code adapts to whatever machine it runs on and however loaded it is at the time.
TiffParallelDecoder
Decodes a TIFF/BigTIFF page in horizontal bands across a pool of isolates — the parallel counterpart to TiffImage.decodeRegionRgba8's single-call, single-core decode, for a page too large to want to decode serially. Every knob here (band height, chunk memory budget, worker count) is an explicit parameter the caller supplies — this class reads no process/OS memory state of its own and makes no assumption about how many CPU cores are safe to use; that judgment belongs to the caller, which is in a much better position to know what else is competing for the same machine's memory and cores.

Functions

decodeTiffFile(File file) TiffDocument
Opens file and decodes it lazily: only the header, IFDs, and whichever strips/tiles are later decoded (via TiffImage.decode / TiffImage.decodeRegion) are actually read from disk.

Typedefs

TiffBand = ({int height, Uint8List rgba, int y})
One band of already-decoded RGBA8 pixels, delivered by TiffParallelDecoder.decodeBanded.