Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.92k stars 1.5k forks source link

Transparency loss when encoding GIF format with GD driver #1389

Closed olivervogel closed 2 months ago

olivervogel commented 2 months ago

Describe the bug

In the case of an image with (semi) transparency, e.g. a PNG format, the transparent areas are lost if the output format is GIF format and the size is changed. This happens only with GD driver.

Code Example

$image = ImageManager::gd()
    ->read($path)
    ->resize(300)
    ->toGif();

Expected behavior

Fully transparent areas should be retained in GIF output.

Images

Input

trans

Output

localhost

Environment (please complete the following information):

olivervogel commented 2 months ago

Fixed in 9f5e0624d4b8d073f58f8bfef71ba8363d9fb688.