using the gd extension: PHP: $path = 'your/path/to/skin.png';$img = @imagecreatefrompng($path);$skinbytes = '';$l = (int)@getimagesize($path)[1];for ($y = 0; $y < $l; $y++) { for ($x = 0; $x < 64; $x++) { $argb = @imagecolorat($img, $x, $y); $a = ((~((int)($argb >> 24))) << 1) & 0xff; $r = ($argb >> 16) & 0xff; $g = ($argb >> 8) & 0xff; $b = $argb & 0xff; $skinbytes .= chr($r) . chr($g) . chr($b) . chr($a); }}@imagedestroy($img);$player->setSkin($skinbytes, 'Standard_Custom');//Standard_CustomSlim for alex//n.b : this code is just an example, there are no checks for the gd extension , the file existence, PNG file header, .png extension, image size but you should add them
Why the @ everywhere? If something wrong happens, an error should be properly triggered. If you want to silence them, you should be responsible for handling them.