How GIFEncoder works in 'auto' vs 'manual' mode
mainThe GIFEncoder behavior changes based on the auto option provided during initialization:
Auto Mode (auto: true)
This is the default. The encoder manages the GIF structure for you. When you call writeFrame for the first time, the encoder automatically:
- Writes the GIF header (
GIF89a). - Writes the Logical Screen Descriptor.
- Writes the Global Color Table (using the
paletteprovided in the first frame's options). - Writes the Netscape Application Extension (if
repeatis provided).
Requirement: In auto mode, the first call to writeFrame must include a palette in its options.
Manual Mode (auto: false)
You have full control over the GIF structure. The encoder will not automatically write headers or global descriptors. You are responsible for ensuring the stream contains the necessary GIF metadata before or during your frame writes.