Skip to content

@loontail/minecraft-kit v0.8.14 / detectSkinVariant

Function: detectSkinVariant()

ts
function detectSkinVariant(png): SkinVariant

Inspect the raw PNG bytes of a Minecraft skin and decide whether it follows the 4-pixel-wide arm ("CLASSIC" / Steve) or 3-pixel-wide arm ("SLIM" / Alex) model.

The check works by sampling pixels that are guaranteed to be transparent in the SLIM layout but opaque in the CLASSIC layout (the 4th column of each arm face in 64×64 skins). Legacy 64×32 skins always return "CLASSIC" because the slim layout does not exist in that format.

Throws MinecraftKitError(INVALID_INPUT) when the input is not a supported PNG (bit-depth other than 8, interlaced, or a color type other than RGB / RGBA).

Parameters

ParameterType
pngUint8Array

Returns

SkinVariant

Example

ts
import { detectSkinVariant } from "@loontail/minecraft-kit";
import { readFile } from "node:fs/promises";

const png = await readFile("./my-skin.png");
const variant = detectSkinVariant(png); // → "CLASSIC" | "SLIM"

Source

src/auth/skin-variant-detect.ts:49

MIT License