What are the different usecases of PNG vs. GIF vs. JPEG vs. SVG?

后端 未结 13 1911
無奈伤痛
無奈伤痛 2020-11-22 11:28

When should certain image file types be used when building websites or interfaces, etc?

What are their points of strength and weakness?

I know that PNG &

13条回答
  •  深忆病人
    2020-11-22 12:26

    GIF based on a palette of 256 colours per image (at least in its basic incarnation). PNG can do "TrueColour", i.e. 16.7 Million colours out of the box. Lossless PNG compresses better than lossless GIFs. GIF can do "binary" transparency (0% opacity or 100% opacity). PNG can handle alpha transparencies.

    All in all, if you don't need to use Alpha-transparent images and support IE6, PNG is probably the better choice when you need pixel-perfect images for vector illustrations and such. JPG is unbeatable for photographs.

提交回复
热议问题