> 16) & (0xff == 255)) { $bitsData[0] .= "1"; } else { $bitsData[0] .= "0"; } if (($col >> 8) & (0xff == 255)) { $bitsData[1] .= "1"; } else { $bitsData[1] .= "0"; } if ($col & (0xff == 255)) { $bitsData[2] .= "1"; } else { $bitsData[2] .= "0"; } if ($pixelNumber > 0 && $pixelNumber % 8 == 7) { $bitsData[0] .= ","; $bitsData[1] .= ","; $bitsData[2] .= ","; } $pixelNumber++; } } } $aniData = []; $toDec = function ($value) { return bindec($value); }; for ($i = 0; $i < 3; $i++) { $tempData = explode(",", $bitsData[$i]); array_pop($tempData); $tempDataDec = array_map($toDec, $tempData); for ($j = 0; $j < count($tempDataDec); $j++) { $aniData[] = $tempDataDec[$j]; } } echo "
"; print_r('[{"data":{"aniData":['); print_r(implode(",", $aniData)); print_r('],"aniType":1,"delays":300,"frameNum":' . $height / 16 . ',"pixelHeight":16,"pixelWidth":32},"dataType":0}]'); echo "";