image icon indicating copy to clipboard operation
image copied to clipboard

White (#FFFFFF) becomes yellowish (#FCFEFC) while resizing GIF

Open raidoa opened this issue 8 years ago • 3 comments

Hi,

Just discovered a challenge where uploaded GIF files will be turned bit yellow after resizing. JPG and PNG are fine.

Will it go under bug or is something missing from the code?

Using version 2.4 with rather plain code:

use Intervention\Image\ImageManagerStatic as Image;

$inputFile = "input.gif";
$img = Image::make($inputFile)->widen(1024, function ($constraint) {
    $constraint->upsize();
  }
);
$img->save("output.gif");

output.gif: output

input.gif: input

raidoa avatar Aug 05 '17 18:08 raidoa

I realize this issue was created over 2 years ago now, but I am seeing the same issue with GIFs in version 2.5. This is the single mention of the issue that I've been able to find anywhere on the interwebs. I'd be grateful if anyone had any suggestions on a fix or workaround.

ghost avatar Aug 09 '19 14:08 ghost

use Imagick; $im = new Imagick($image); $im->resizeImage(500,582,(FIlter),1,false); that filter para causing the issues,if I resize without (filter),param (No change in color in output image). Resize Using Imagick Solves,But I dnt know how to edit resize method in Intervention.

Sublan avatar Oct 28 '20 10:10 Sublan

Unfortunately, this happens when GIF formats (with an indexed color palette) are converted with the GD Library to Truecolor and then transformed back to an indexed color format.

This is only indirectly related to this library.:

// example without intervention image
$gd = imagecreatefromgif('ffffff.gif'); // complety white image
imagepalettetotruecolor($gd);
imagegif($gd, 'output.gif'); // white becomes yellowish

With Intervention Image, all formats are always normalized to truecolor format with GD. This ensures that the image quality is maintained during operations.

Unfortunately, I cannot offer a bugfix at the moment and can only recommend switching to Imagick.

olivervogel avatar Aug 17 '24 07:08 olivervogel