<p>The reason is the GD image library. If you switch to imagick, the transparent background will be clean:</p>

<p>Resized, clean:</p>

<p><a href="https://i.sstatic.net/9EGyB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9EGyB.png" alt="clean resize"></a></p>

CC BY-SA 3.0
2017-07-06T09:57:42.107Z
2017-07-06T09:57:42.107Z
Matthias Redl-Mann
<p>for anyone experiencing dirty transparent backgrounds when you transform transparent PNG images with Craft like this:</p>

<p>Source Image:</p>

<p><a href="https://i.sstatic.net/hn3Pg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hn3Pg.png" alt="Src Image"></a></p>

<p>Resized, dirty:</p>

<pre><code>Craft Command: craft.assets.id(2).first().getUrl({width: 300})
</code></pre>

<p><a href="https://i.sstatic.net/3uLD8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3uLD8.png" alt="dirty image, 300px width"></a></p>

<p>If you don't see the dirt, watch screen from the side!</p>

<image-transforms>
Craft creating dirty transparent background on image transformations / resizing
# Craft creating dirty transparent background on image transformations / resizing

(Asked by: username_0 on 2017-07-06)

for anyone experiencing dirty transparent backgrounds when you transform transparent PNG images with Craft like this:
Source Image:

Resized, dirty:
Craft Command: craft.assets.id(2).first().getUrl({width: 300})


If you don't see the dirt, watch screen from the side!

**Tags:** image-transforms


---

## 1 answers

### Answer by username_0 on 2017-07-06. Score: 3 | Accepted answer

The reason is the GD image library. If you switch to imagick, the transparent background will be clean:

Resized, clean:

[![clean resize](https://i.sstatic.net/9EGyB.png)](https://i.sstatic.net/9EGyB.png)


---

