Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How works gzip_types image/jpeg

Tags:

nginx

gzip

I now and always use gzip with nginx but never use it for images. Try to find some adventages/disadventages of that kind solution but nothing found.

Of course I can use client side caching in nginx and set expired days for images - but then first load will be always full load without any optimization.

Soo should I or shouldnt gzip images jpeg png etc. ? What this type of commpresion do - change commpression of images to lower quality?

like image 293
Wordica Avatar asked Oct 06 '15 23:10

Wordica


People also ask

Can I use gzip to compress images?

Image file formats supported by the web, as well as videos, PDFs and other binary formats, are already compressed; using gzip on them won't provide any additional benefit, and can actually make them larger. To compress images, see Optimize images.

How do I serve a gzip file using Nginx?

The command requests a file from our Nginx server and specifies that it is fine to serve gzip compressed content by using an HTTP header ( Accept-Encoding: gzip ): In the last line, you can see the Content-Encoding: gzip header. This tells us that gzip compression was used to send this file.

How to configure your server for gzip or Brotli compression?

So the standard way to configure your server for Gzip or Brotli is by providing a list of MIME types you want to compress. How to add a MIME type to the compression list?

What is a JPG file?

The JPG or JPEG (Joint Photographics Experts Group) is one of the most used image formats due to its ability to be opened up and converted by almost any standard program - all while file size remains relatively small.


Video Answer


1 Answers

You don't compress images because images are already compressed. In some cases it can actually make them larger (but I've forgotten the reason why). These are binary formats, similar to videos and you won't gain any benefit.

like image 98
Rob Avatar answered Sep 26 '22 00:09

Rob