png-compressor
    Preparing search index...

    Interface IEncodePngOptionsInternal

    An optional set of options to encode an image with. The options override the specified property when encoding, except for the case where it's not possible to encode the image with that option at which point it will be overridden (unless IEncodePngOptions.strictMode is used).

    Using the Truecolor color type that contains transparency will use either truecolor with
    a tRNS chunk or truecolor and alpha depending on which is smaller.
    Using the TruecolorAndAlpha color type will always use it.
    

    An EncodeError when an error is encountered or a EncodeWarning when a warning is encountered in strict mode. In Typescript, instanceof can be used to narrow the type safely.

    interface IEncodePngOptionsInternal {
        ancillaryChunks?: (
            IPngMetadataCompressedTextualData
            | IPngMetadataTextualData
        )[];
        bitDepth?: BitDepth;
        colorType?: ColorType;
        filterPattern?: FilterType[];
        strictMode?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Additional metadata to encode as chunks in the png.

    bitDepth?: BitDepth

    The bit depth to encode with. When unspecified, the library will scan the image and determine the best value based on the content, it's best to pass this in if know to avoid the scan iterating over every pixel in the image.

    colorType?: ColorType

    What color type to encode with. Remarks:

    • When unspecified, the library will decide what color type to use.
    • When grayscale is used, only the red channel will be considered when encoding as the image is expected to be a valid grayscale image.
    • When grayscale or truecolor are used and transparent colors exist, the resulting image will be "upgraded" to ColorType.GrayscaleAndAlpha/ColorType.TruecolorAndAlpha or the tRNS chunk will be used, depending on which consumes less bytes.
    filterPattern?: FilterType[]

    An optional filter pattern used for testing. This is internal only as it's not useful outside of testing to ensure each permutation is correct, unless the image is analyzed outside of the library but that's out of scope for this library.

    strictMode?: boolean

    Enabled strict encoding which will throw when warnings are encountered.