Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-06T09:57:42.107Z
Answers.LastActivityDate: 2017-07-06T09:57:42.107Z
Answers.UserDisplayName: Matthias Redl-Mann
Body: <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>
  
Tags: <image-transforms>
Title: Craft creating dirty transparent background on image transformations / resizing
ThreadText: # 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:
  
  [![Src Image](https://i.sstatic.net/hn3Pg.png)](https://i.sstatic.net/hn3Pg.png)
  
  Resized, dirty:
  
  ```
  Craft Command: craft.assets.id(2).first().getUrl({width: 300})
  
  ```
  
  [![dirty image, 300px width](https://i.sstatic.net/3uLD8.png)](https://i.sstatic.net/3uLD8.png)
  
  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)
  
  
  ---
  
  