Body: <p>I found searching through other questions here that:</p>
  
  <blockquote>
    <p>Currently the images are being cleansed on upload, which means that
    they are being re-saved to make sure that no malicious code is
    injected in them.</p>
  </blockquote>
  
  <p>The problem I have is that <strong>optimized 8-bit PNGs with alpha transparency</strong> (like the ones TinyPng creates) are <strong>transformed on upload to indexed, non-alpha transparency PNGs</strong> - and as a result they look very bad.</p>
  
  <p>I'm not even using any transforms, so this is just from the "cleansing" that Craft does automatically on upload.</p>
  
  <p>I initially was using the GD library but then I installed ImageMagick and even forced Craft to use ImageMagick through the config setting - nothing helped</p>
  
  <p>Image uploads work just fine with ImageMagick, except the PNG issue described above.</p>
  
  <p>Is there something I need to configure in the ImageMagick library or it's PHP plugin? Or can I disable the "cleansing" that Craft does? (I don't want to do that since I love the added security, but I really need to use transparent, compressed PNGs in my website designs).</p>
  
  <p>Thanks in advance!</p>
  
  <p>Edit: Here's a PNG image, before and after upload (just posted the links, since theimage is big and I didn't want to mess up the thread):</p>
  
  <p><a href="https://i.sstatic.net/tJvpY.png" rel="nofollow noreferrer">Before the upload</a> - shows as RGB mode in Photoshop - has alpha transparency. Was saved as PNG 24 from PS then compressed with TinyPNG</p>
  
  <p><a href="https://i.sstatic.net/W0I9b.png" rel="nofollow noreferrer">After the upload</a> - shows as Indexed mode in Photoshop - no alpha transparency - was re-saved by Craft on upload from the CP.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-18T23:17:26.230Z
Comments.Text: What version of Craft? Can you post up both images, the one before/after Craft?
Comments.UserDisplayName: RitterKnight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-19T03:37:02.337Z
Comments.Text: This could end up being a bug in Craft.  Can you send a PNG over to support@buildwithcraft.com and reference this post so we can look into it?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-19T06:45:07.263Z
Comments.Text: @RitterKnight - using latest version of Craft as of this post (2.4.2699) Edited the post to add link to sample before and after images.
Comments.UserDisplayName: Ovi Savescu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-19T06:45:13.123Z
Comments.Text: @BradBell - I did what you said, also attached the error logs, db backup and template files. Thanks!
Comments.UserDisplayName: Ovi Savescu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-19T18:58:42.303Z
Comments.Text: Also interesting to note that Craft's version has the sRGB color profile embedded making the file larger as well.
Comments.UserDisplayName: RitterKnight
Tags: <upload>
Title: Uploaded 8-bit PNGs losing alpha transparency (using ImageMagick)
ThreadText: # Uploaded 8-bit PNGs losing alpha transparency (using ImageMagick)
  
  (Asked by: username_0 on 2015-10-18)
  
  I found searching through other questions here that:
  
  > Currently the images are being cleansed on upload, which means that
  > they are being re-saved to make sure that no malicious code is
  > injected in them.
  
  The problem I have is that **optimized 8-bit PNGs with alpha transparency** (like the ones TinyPng creates) are **transformed on upload to indexed, non-alpha transparency PNGs** - and as a result they look very bad.
  
  I'm not even using any transforms, so this is just from the "cleansing" that Craft does automatically on upload.
  
  I initially was using the GD library but then I installed ImageMagick and even forced Craft to use ImageMagick through the config setting - nothing helped
  
  Image uploads work just fine with ImageMagick, except the PNG issue described above.
  
  Is there something I need to configure in the ImageMagick library or it's PHP plugin? Or can I disable the "cleansing" that Craft does? (I don't want to do that since I love the added security, but I really need to use transparent, compressed PNGs in my website designs).
  
  Thanks in advance!
  
  Edit: Here's a PNG image, before and after upload (just posted the links, since theimage is big and I didn't want to mess up the thread):
  
  [Before the upload](https://i.sstatic.net/tJvpY.png) - shows as RGB mode in Photoshop - has alpha transparency. Was saved as PNG 24 from PS then compressed with TinyPNG
  
  [After the upload](https://i.sstatic.net/W0I9b.png) - shows as Indexed mode in Photoshop - no alpha transparency - was re-saved by Craft on upload from the CP.
  
  **Tags:** upload
  
  > **Comments:**
  > **username_1**: What version of Craft? Can you post up both images, the one before/after Craft?  
  > **username_2**: This could end up being a bug in Craft.  Can you send a PNG over to support@buildwithcraft.com and reference this post so we can look into it?  
  > **username_0**: @username_1 - using latest version of Craft as of this post (2.4.2699) Edited the post to add link to sample before and after images.  
  > **username_0**: @username_2 - I did what you said, also attached the error logs, db backup and template files. Thanks!  
  > **username_1**: Also interesting to note that Craft's version has the sRGB color profile embedded making the file larger as well.  
  
  ---
  
  ## 0 answers
  
  