AutoMovie API
    Preparing search index...

    Variable encodeAutoMoviePngConst

    encodeAutoMoviePng: (props: IAutoMovieEncodePng.IProps) => string = ...

    Encode raw 8-bit pixels as a PNG file in the padded base64 an IAutoMovieImage carries, for an image code generates together with a model.

    The file is a signature, IHDR, one IDAT and IEND (PNG, W3C second edition, sections 5, 11.2): bit depth 8, non-interlaced, colour type 0, 4, 2 or 6 for one to four channels, which is the subset engine admission and the viewer decode. Each scanline takes filter type 0, and the zlib stream (RFC 1950) holds the filtered bytes in stored deflate blocks of at most 65,535 bytes (RFC 1951 section 3.2.4), with the Adler-32 of the uncompressed data; each chunk ends in the CRC-32 of its type and data. Stored blocks keep the encoder a few lines and the output a pure function of the pixels, at the cost of no compression: the file is the raw size plus about 0.1 percent. Base64 follows RFC 4648 section 4 without Buffer or btoa, so the bytes are the same in Node and every browser.

    Type Declaration

      • (props: IAutoMovieEncodePng.IProps): string
      • Parameters

        • props: IAutoMovieEncodePng.IProps

          Borrowed 8-bit interleaved pixels for encodeAutoMoviePng. The encoder reads without mutation and returns padded base64 PNG bytes without a data: prefix; image identity is assigned separately by the caller.

          Output uses bit depth 8, no interlace, filter zero and stored deflate blocks, with no compression or color-management metadata. Dimensions/channel count/buffer length are checked before encoding; host allocation failures still propagate.

          • channels: 1 | 2 | 3 | 4

            Bytes per pixel: 1 grayscale, 2 grayscale/alpha, 3 RGB, 4 RGBA; this order is preserved.

          • height: number

            Positive safe integer rows in pixels, checked by the encoder.

          • pixels: Uint8Array

            Row-major interleaved samples in supplied row order, exactly widthheightchannels bytes. The encoder performs no vertical flip, premultiplication or color conversion.

          • width: number

            Positive safe integer columns in pixels, checked by the encoder.

        Returns string

        Padded base64 of the PNG file, without a data: prefix

    When a dimension is not a positive integer, the channel count is not 1 to 4, or the pixel buffer has the wrong length