Forum Moderators: phranque
(one image = 14 kb,
two images = 7kb + 5 kb = 12 kb)
Should I do it?
Now there are two http request for two images but it saves 2 kb, will it perform better?
Thanks
Anirudh Lohia
Now there are two http request for two images but it saves 2 kb
Besides the additional http request, there are other sources for overhead. Even though there is 2k less data, it's possible that the same number of packets will be required and also, now the browser will need to manage twice the number of images. Additionally, a browser can only handle a limited number of simaltanious requests and may need to wait until one request is finished before even requesting the other.
It sounds like the two images will be of lower quality than the original; how else can the two, with the additional overhead of a second image, contain a greater amount of information in less space. If the original image is a .jpg, by slightly increasing the compression rate you might be able to save even more than the 2k. Also, with .jpg, whenever you resave it you loose quality. Theefor, you should always work with as high a quality image as possible and only compress the final product.
If the image is a .png you should check that the single is using the same compression rate. (Since .png compression is lossless, there is no issue of resaving images.)