I am trying to get custom capes from png files with: PHP: $image = imagecreatefrompng($this->getDataFolder() . "cape.png");$data = '';for ($y = 0, $height = imagesy($image); $y < $height; $y++) { for ($x = 0, $width = imagesx($image); $x < $width; $x++) { $color = imagecolorat($image, $x, $y); $data .= pack("c", ($color >> 16) & 0xFF) //red . pack("c", ($color >> 8) & 0xFF) //green . pack("c", $color & 0xFF) //blue . pack("c", 255 - (($color & 0x7F000000) >> 23)); //alpha }} and then setting $data to the capedata paramter in the skin class. I am pretty sure this is for skins only though and not capes because the post I got this from used it for skins and I get Specified skin is not valid, must be 8KiB or 16KiB. The length of the data is only 4096 characters too. How can I get something like this working for capes only instead?
According to this thread, capes have to be 8192 bytes. P.S: I just googled "pmmp capes" to find this.
No, it can be used for capes too. I've checked this code with a simple script (can't check with PM right now, because my MCW10E has updated to v1.5... ) and it should work fine. Spoiler PHP: <?php$image = imagecreatefrompng("cape.png");$data = '';for ($y = 0, $height = imagesy($image); $y < $height; $y++) { for ($x = 0, $width = imagesx($image); $x < $width; $x++) { $color = imagecolorat($image, $x, $y); $data .= pack("c", ($color >> 16) & 0xFF) //red . pack("c", ($color >> 8) & 0xFF) //green . pack("c", $color & 0xFF) //blue . pack("c", 255 - (($color & 0x7F000000) >> 23)); //alpha }}echo strlen($data) . " bytes!\n"; Could you please post the "cape.png", that you're trying to read?
Seems like the pngs are the issue, since they are 744 bytes and 808 bytes respectively. I don't even know if that matters though.
As I thought, those are not of the right format. Using this template, you can try to convert them, but they are both larger than a usual cape. As for what causing the problem is that those cape PNGs don't have the large empty area and that's why they're smaller when they're uncompressed. Spoiler: Cape template explained Red - front Green - back Blue - top Magenta - bottom Cyan - left and right sides