: Compressing images for desktop and mobile site or adjust size? I was looking at http://marcjschmidt.de/blog/2013/10/25/php-imagepng-performance-slow.html and towards the end of the document, I learned
I was looking at marcjschmidt.de/blog/2013/10/25/php-imagepng-performance-slow.html and towards the end of the document, I learned something from the chart at the end.
If I use a very high compression on an image, the processing time (including TTFB) will be higher and the download time will be smaller.
The opposite is true if I use low compression.
The problem here is if I pick too low of compression, then it will take substantially longer for people to load images on my site. If I pick too high of compression, then I believe the TTFB (time to first byte) value will be high. If that value is too high, then google might see my image loading speed as slow.
Currently for the desktop version of my site, I'm using full-sized images at 80% JPEG quality, and for mobile site, I'm using 66% quality.
I'm afraid if I raise the quality of the image (aka reduce compression) on either site, then there will be more data to download and some people might be billed high for data usage. My other option is to adjust the image size some more, but then if I go too small, visitors might complain.
So whats the best thing to do? adjust JPEG image quality to different values (more optimal values)? or do I shrink the images and pray for no complaints?
More posts by @LarsenBagley505
1 Comments
Sorted by latest first Latest Oldest Best
The article is misleading because it suggests that the server must compress content on the fly for every client and it must compress it each time. That is a waste of cycles.
Use the best of both worlds:
You compress your images one time as good as possible (pngout, zopflipng, irfanview webjpg plugin) and then you switch off server-side compression for images and serve those precompressed images. If you generate images so you cannot precompress them, stop that.
Step 1:
Compress your images as good as possible. Quench down the last byte even if it lasts several minutes for one image.
Step 2:
Tell your server with .htaccess that you do not need server compression for images
RewriteRule ".jpg$" "-" [T=image/jpeg,E=no-gzip:1]
RewriteRule ".gif$" "-" [T=image/gif,E=no-gzip:1]
RewriteRule ".png$" "-" [T=image/png,E=no-gzip:1]
or globally (then you need to precompress everything)
SetEnv no-gzip 1
(If you have other endings like jpeg instead of jpg, add that, too).
The decompression time on the client side is neglible, in fact the better the compression, the faster the decompression.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.