The image you are showing does not have shades of gray, it is just flipped. Try to invert color bytes and you will get good colors. There is a problem with CMYK color memory in JPEG images because Photoshop saves 100% of the colors as 0x0.
edit: how to invert to PHP taken from this blogpost It works with rgb data and needs to be adapted to work with CMYK
<?php function image_filter_invert(&$image){ $width = imagesx($image); $height = imagesy($image); for($x = 0; $x < $width; $x++){ for($y = 0; $y < $height; $y++){ $rgb = imagecolorat($image, $x, $y); $r = 0xFF-(($rgb>>16)&0xFF); $g = 0xFF-(($rgb>>8)&0xFF); $b = 0xFF-($rgb&0xFF); $color = imagecolorallocate($image, $r, $g, $b); imagesetpixel($image, $x, $y, $color); } } } ?>
source share