Seems like there's couple of bits too many...
function fixBlue($im)
{
$f_im = imagecreatetruecolor(imagesx($im),imagesy($im));
$c = imagecolorallocate($f_im, 255, 255, 255);
imagefill($f_im, 0, 0, $c);
for($y=0;$y<imagesy($im);$y++)
{
for($x=0;$x<imagesx($im);$x++)
{
$rgb_old = imagecolorat($im, $x, $y);
$r = ($rgb >> 24) & 0xFF;
$g = ($rgb >> 16) & 0xFF;
$b = ($rgb >> 8) & 0xFF;
$pixelcolor = imagecolorallocate($f_im, $r, $g, $b);
imagesetpixel($f_im, $x, $y, $pixelcolor);
}
}
return $f_im;
}
and then just:
$img = imagecreatefromwebp('https://lh4.ggpht.com/uaLB-tbci94IubJJhDZ4n6vJwGF4i9MpFLXl28LBHjVzLIy-K6fhoSILbM4yJcKqq9I=h900-rw');
$img_f = fixBlue($img, 60);
ob_end_clean();
header('Content-type: image/jpeg');
imagejpeg($img_f, null, 80);
imagedestroy($img);
imagedestroy($img_f);
convert https://lh4.ggpht.com/uaLB-tbci94IubJJhDZ4n6vJwGF4i9MpFLXl28LBHjVzLIy-K6fhoSILbM4yJcKqq9I=h900-rw image.jpg
– Shedevil