【发布时间】:2014-07-18 08:51:29
【问题描述】:
我尝试使用 Gifcreator php 类从 10 个 PNG 图像创建动画 GIF 图像。 动画图像已创建,但原始图像的透明度丢失。我有一个黑色的背景。 文档说透明度由第一个加载的图像确定。这 10 张图像具有透明背景。我在 Paint 中加载了 htem,它说它是基于白色的。
有没有人解决这个问题?
谢谢,
课程在这里:https://github.com/Sybio/GifCreator
我的脚本在这里:http://www.egloff.eu/rsmaptest/slideshow.php
这里的第一张图片:http://www.egloff.eu/rsmaptest/images/image0.png
代码:
<?php
// Include the class
require_once('./testcreator/GifCreator.php');
// Instanciate the class (uses default options with the addition of width/height specified)
$gif = new GifCreator(0, 2, array(0, 0, 0),550,550);
// Add each frame to the animation
$gif->addFrame(file_get_contents('images/image9.png'), 100, true);
$gif->addFrame(file_get_contents('images/image8.png'), 100, true);
$gif->addFrame(file_get_contents('images/image7.png'), 100, true);
$gif->addFrame(file_get_contents('images/image6.png'), 100, true);
$gif->addFrame(file_get_contents('images/image5.png'), 100, true);
$gif->addFrame(file_get_contents('images/image4.png'), 100, true);
$gif->addFrame(file_get_contents('images/image3.png'), 100, true);
$gif->addFrame(file_get_contents('images/image2.png'), 100, true);
$gif->addFrame(file_get_contents('images/image1.png'), 100, true);
$gif->addFrame(file_get_contents('images/image0.png'), 500, true);
// Output the animated gif
header('Content-type: image/gif');
echo $gif->getAnimation();
?>
【问题讨论】:
-
我的问题出在哪里?贴出来的cmets都去哪儿了?
-
问题的问题在“保留”框中描述。现在您添加了必要的信息,我重新投票。答案很可能是作者在意识到答案不正确后删除的。
标签: php image class transparency