Validate unit sprite PNG color mode

This commit is contained in:
2026-07-05 15:14:24 +09:00
parent 947dc222c7
commit 91842d2e30

View File

@@ -208,6 +208,9 @@ function validatePngDimensions(errors, key, path, expected) {
if (dimensions.width !== expected.width || dimensions.height !== expected.height) {
errors.push(`${key}: expected ${expected.width}x${expected.height}, got ${dimensions.width}x${dimensions.height}`);
}
if (dimensions.bitDepth !== 8 || dimensions.colorType !== 6) {
errors.push(`${key}: expected 8-bit RGBA PNG color type 6, got bitDepth=${dimensions.bitDepth} colorType=${dimensions.colorType}`);
}
}
function readPngDimensions(path) {
@@ -224,6 +227,8 @@ function readPngDimensions(path) {
return {
width: bytes.readUInt32BE(16),
height: bytes.readUInt32BE(20)
height: bytes.readUInt32BE(20),
bitDepth: bytes[24],
colorType: bytes[25]
};
}