终于部分解决了gif透明图的缩略问题

直接使用php的imagecopyresampled来处理透明背景的gif时,透明背景会变为黑色。

改为用MagickWand似乎也没有改善。

今天又看了一遍

http://forums.devshed.com/php-development-5/gd-image-resize-transparent-gif-337812.html,终于想出了一个替代的解决办法。具体就是先用

$black imagecolorallocate($imgDestination3000);
imagefill($imgDestination300$black);

把缩略图的背景填满某个很难被用到的颜色,然后生成gif的时候把这个颜色作为透明就行了。


Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>