Appearance
@loontail/minecraft-kit v0.8.14 / detectSkinVariant
Function: detectSkinVariant()
ts
function detectSkinVariant(png): SkinVariantInspect 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
| Parameter | Type |
|---|---|
png | Uint8Array |
Returns
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"