We've got quite a few PNG image files for a site build, so naturally we're running them through tinypng to reduce size. This works great locally, but when we upload them to assets (S3) the file size is getting huge again.

Pic: https://cl.ly/152u2C2D3g2n

193kb to 440kb in this example ^ which is typical.

Any thoughts?


1 Answer 1


I agree with Brad's comment, this is very similar to those two other threads.

That being said, here is an important quote which is buried on one of those threads...

When an image is first uploaded, Craft will "sanitize" the image for any malicious code by re-saving the image out to a new file. It jumps through some pretty significant to ensure that the sanitized image is as close to possible as the originally uploaded image in both quality and file size, which usually explains the differences people see in file sizes.

I believe this is what the OP is experiencing.

  • Hey Lindsey, is this suggesting that any optimization done for the web (in the case of our PNGs) will be overwritten—or rewritten—when Craft re-saves an image before it's added onto the server? I might be missing the finesse points here. That said, if that is the case, what's the move to optimize PNGs for better web use?
    – CFA
    Commented Sep 14, 2016 at 15:51
  • @Chris: Yes, Craft will likely undo your optimizations during the sanitization process. However, you can circumvent this by uploading files via FTP, and then "Update Asset Indexes".
    – Lindsey D
    Commented Sep 14, 2016 at 17:01
  • 2
    @Chris: You may also find one of these plugins helpful... Imager, or Tiny Image. They are both capable of optimizing your images after they've been uploaded.
    – Lindsey D
    Commented Sep 14, 2016 at 17:03
  • Thanks Lindsey, we'll take a peek! Appreciate your thoughts here.
    – CFA
    Commented Sep 22, 2016 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.