PNG wrong defaults mapping?
The attributes from pngjs look different as in image-encode.
image-encode
// encode png buffer
'use strict'
var PNG = require('pngjs').PNG
var toab = require('to-array-buffer')
var x = require('object-assign')
module.exports = function (data, o) {
o = x({
data: Buffer.from(data)
}, o)
if (o.interlace == null) o.interlace = false
if (o.palette == null) o.palette = false
if (o.depth == null) o.depth = 8
if (o.color == null) o.color = true
if (o.bpp == null) o.bpp = 3
if (o.colorType == null) o.colorType = 2
if (o.gamma == null) o.gamma = 0
var buff = PNG.sync.write(o)
return toab(buff)
}
pngjs
Options width - use this with height if you want to create png from scratch height - as above checkCRC - whether parser should be strict about checksums in source stream (default: true) deflateChunkSize - chunk size used for deflating data chunks, this should be power of 2 and must not be less than 256 and more than 32*1024 (default: 32 kB) deflateLevel - compression level for deflate (default: 9) deflateStrategy - compression strategy for deflate (default: 3) deflateFactory - deflate stream factory (default: zlib.createDeflate) filterType - png filtering method for scanlines (default: -1 => auto, accepts array of numbers 0-4) colorType - the output colorType - see constants. 0 = grayscale, no alpha, 2 = color, no alpha, 4 = grayscale & alpha, 6 = color & alpha. Default currently 6, but in the future may calculate best mode. inputColorType - the input colorType - see constants. Default is 6 (RGBA) bitDepth - the bitDepth of the output, 8 or 16 bits. Input data is expected to have this bit depth. 16 bit data is expected in the system endianness (Default: 8) inputHasAlpha - whether the input bitmap has 4 bytes per pixel (rgb and alpha) or 3 (rgb - no alpha). bgColor - an object containing red, green, and blue values between 0 and 255 that is used when packing a PNG if alpha is not to be included (default: 255,255,255)