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

后端 未结 13 2005
無奈伤痛
無奈伤痛 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:21

    I usually go with PNG, as it seems to have a few advantages over GIF. There used to be patent restrictions on GIF, but those have expired.

    GIFs are suitable for sharp-edged line art (such as logos) with a limited number of colors. This takes advantage of the format's lossless compression, which favors flat areas of uniform color with well defined edges (in contrast to JPEG, which favors smooth gradients and softer images).

    GIFs can be used for small animations and low-resolution film clips.

    In view of the general limitation on the GIF image palette to 256 colors, it is not usually used as a format for digital photography. Digital photographers use image file formats capable of reproducing a greater range of colors, such as TIFF, RAW or the lossy JPEG, which is more suitable for compressing photographs.

    The PNG format is a popular alternative to GIF images since it uses better compression techniques and does not have a limit of 256 colors, but PNGs do not support animations. The MNG and APNG formats, both derived from PNG, support animations, but are not widely used.

提交回复
热议问题