JPEG: size and compression

Pretty simple but specific question:

I am not completely familiar with the JPEG standard for image compression. Does it create an image (a smaller file size with the same quality) when the size X (width) is very large and the size Y (height) is very small, on the contrary, or when they are almost equal?

The practical use I have for this is CSS sprites. If a website consisted of hundreds of CSS sprites, it would be ideal to minimize the size of the sprite file to help users access the Internet more slowly and reduce server load. If the JPEG standard works very well on one horizontal line, but moving vertically requires much more complexity, it would be advisable that the image of 100 CSS 16x16 sprites be equal to 1600x16.

On the other hand, if the JPEG standard is more complex, working horizontally, but easily moving from line to line, you can make a smaller file or get a higher quality by making a 16x1600 image.

If the best compression occurs when the image is a perfect square, you want the final image to be 160x160

+3
source share
2 answers

The MPEG / JPEG locking mechanism (very little) favors an image size that is an exact multiple of the compression block size in each dimension. However, in addition, the format does not care if the blocks are vertical or horizontal.

, ", ", JPEG ( , 8, 16, 24 32 ).

, "" spites , GIF JPG, , . , JPG " ".

+4

, JPEG . , , 8, 16, .

http://en.wikipedia.org/wiki/JPEG#JPEG_codec_example

, PNG ( ) , , . JPEG? ( , 16x16 , ), PNG .

+4

Source: https://habr.com/ru/post/1774739/