Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('should build valid skin texture', () => {
const texture = leetModelData.textures[0]
const buildedSkin: Uint8Array = png.encode({
width: texture.width,
height: texture.height,
data: buildTexture(leetBuffer, texture)
})
expect(Buffer.from(buildedSkin)).toMatchImageSnapshot()
})
width: image.width,
height: image.height,
components: image.components,
alpha: image.alpha,
bitDepth: image.bitDepth,
data: image.data
};
if (data.bitDepth === 1 || data.bitDepth === 32) {
data.bitDepth = 8;
data.components = 3;
data.alpha = 1;
data.data = image.getRGBAData();
}
return realEncodePng(data, options);
}
export function encodePng(
image: Image,
options?: IPNGEncoderOptions
): Uint8Array {
return encode(image, options);
}