OptionalancillaryAdditional metadata to encode as chunks in the png.
OptionalbitThe 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.
OptionalcolorWhat color type to encode with. Remarks:
tRNS chunk will be used, depending on which consumes less bytes.OptionalfilterAn 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.
OptionalstrictEnabled strict encoding which will throw when warnings are encountered.
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).
Example
Example
Throws
An EncodeError when an error is encountered or a EncodeWarning when a warning is encountered in strict mode. In Typescript,
instanceofcan be used to narrow the type safely.