# php缩放图片时白色背景变成了透明色

**URL:** <https://www.shiqidu.com/t/topic/388>\
**Category:** 开发调优\
**Tags:** PHP\
**Created:** [2018 年4 月 3 日 02:12 UTC](https://www.shiqidu.com/t/topic/388 "2018-04-03T02:12:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Leon](https://www.shiqidu.com/user_avatar/www.shiqidu.com/leon/32/5_2.png) [@Leon](https://www.shiqidu.com/u/Leon)\
发布日期： [2018 年4 月 3 日 02:12 UTC](https://www.shiqidu.com/t/topic/388/1 "2018-04-03T02:12:53Z")

</div>

在缩放图片时白色背景的图片，经过缩放后白色背景全变成了透明。

后来排查是多加了这句代码

```auto
imagecolortransparent($img,$color);

```

去掉之后就好了
