1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-09 21:50:47 +02:00

fixed gif encoding looses transparency

This commit is contained in:
Oliver Vogel
2014-06-26 16:58:34 +02:00
parent fd4a76e59e
commit c77ddc29f5
3 changed files with 29 additions and 0 deletions

View File

@@ -1506,6 +1506,20 @@ class GdSystemTest extends PHPUnit_Framework_TestCase
$this->assertInternalType('resource', $cln->getCore());
}
public function testGifConversionKeepsTransparency()
{
$save_as = 'tests/tmp/foo.gif';
// create gif image from transparent png
$img = $this->manager()->make('tests/images/star.png');
$img->save($save_as);
// new gif image should be transparent
$img = $this->manager()->make($save_as);
$this->assertTransparentPosition($img, 0, 0);
@unlink($save_as);
}
private function assertColorAtPosition($color, $img, $x, $y)
{
$pick = $img->pickColor($x, $y, 'hex');

View File

@@ -1487,6 +1487,20 @@ class ImagickSystemTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('Imagick', $cln->getCore());
}
public function testGifConversionKeepsTransparency()
{
$save_as = 'tests/tmp/foo.gif';
// create gif image from transparent png
$img = $this->manager()->make('tests/images/star.png');
$img->save($save_as);
// new gif image should be transparent
$img = $this->manager()->make($save_as);
$this->assertTransparentPosition($img, 0, 0);
@unlink($save_as);
}
private function assertColorAtPosition($color, $img, $x, $y)
{
$pick = $img->pickColor($x, $y, 'hex');