2

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?

4

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.

| improve this answer | |
  • 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? – Chris Sep 14 '16 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 Sep 14 '16 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 Sep 14 '16 at 17:03
  • Thanks Lindsey, we'll take a peek! Appreciate your thoughts here. – Chris Sep 22 '16 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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