0

Does 'Content-Encoding': 'gzip' reduce the file size in AWS S3?

Documentation says: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding

This lets the recipient know how to decode the representation in order to obtain the original payload format.

Does it mean if a file / image / GIF is sent to S3, AWS will decode it and save it in a decoded way? Or S3 will store it in a compressed way, and serve it also in a compressed way?

In my case we store GIF-s in S3, and they have to be smaller than 8 MB. So need some kind of compression.

  • Regardless of the answer, GIF files are already compressed with LZW compression, so compressing them again is unlikely to see more than 1-2% decrease in size, if any. – Anon Coward Jul 13 '22 at 23:00
  • We are using https://jnordberg.github.io/gif.js/ to render GIF, do you think it is compressing the frames? –  Jul 13 '22 at 23:09
  • Yes, it [is](https://github.com/jnordberg/gif.js/blob/master/src/LZWEncoder.js) – Anon Coward Jul 13 '22 at 23:09

1 Answers1

0

content type is applied on the fly on the image. You can disable and enable the content type headers on the s3 and check the file size on s3. They will be the same in both the cases.

chendu
  • 684
  • 9
  • 21