function imagecreatefrombmp($p_sFile) { $hex = $temp[1]; $header_parts = str_split($header, 2); } $x = 0; $y = 1; $image = imagecreatetruecolor($width, $height); $header_size = ($width * $height); $usePadding = ($body_size > ($header_size * 3) + 4); for ($i = 0; $i < $body_size; $i+=3) { if ($x >= $width) { if ($usePadding) $i += $width % 4; $x = 0; $y++; if ($y > $height) break; } $i_pos = $i * 2; $color = imagecolorallocate($image, $r, $g, $b); imagesetpixel($image, $x, $height - $y, $color); $x++; } return $image; } $image = imagecreatefrombmp("1.bmp"); imagejpeg($image);
jednak po jej wykonaniu dostaje jakiś dziwny rozjechany obrazek:

Powinno byc:

Co robię nie tak?