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?

CFA
  • 61
  • 2
  • 1
    Similar? https://craftcms.stackexchange.com/questions/1445/using-image-transforms-sometimes-results-in-bloated-file-sizes and https://craftcms.stackexchange.com/questions/12398/images-much-larger-on-server-and-page-than-the-local-version – Brad Bell Sep 14 '16 at 03:02
  • In this case, it isn't happening after an image transform. We're taking images from our local machines, dragging them into Assets, they upload into S3, and on their arrival into S3, are larger in size than what's on our machine. And not by a few KB, in some cases 200+ KB larger. – CFA Sep 14 '16 at 15:48

1 Answers1

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.

Lindsey D
  • 23,974
  • 5
  • 53
  • 110
  • 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 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. – CFA Sep 22 '16 at 19:19