JEPG was created in 1992 by the Joint Photographic Experts Group and is named after its creator. JPEG is a lossy raster image format, which means that every time a JPEG is compressed and saved, some information
is irreversibly lost.
JPEG takes advantage of flaws in human eye perception - being more sensitive to brightness than color - using a compression algorithm that discards information we're not very good at getting at, and is therefore a "lossy format". The compression setting will determine the size and quality of the final saved file.
#Photos, as well as complex or shaded images such as paintings, are good examples of using JPEG.
Compressed JPEG
Very high — 80%
Best — 100%
Best 100% (61 KB), Very High 80% (29 KB).
##High 60% (16 KB), Medium 80% (7 KB).
Low 100% (6 KB), Minimum 0% (3 KB).
The Web page recommends using JPEGs between 50% and 60% quality, Because it combines good image quality with small file size. Removing metadata can also reduce JPEG file size.
In Photoshop, compression can be accomplished by selecting "Metadata: None" or "Save for Web (Legacy)" in "Export". Blurring all or part of an image will also produce smaller file sizes.
Please note that since JPEG is a lossy format, even saving the same file at 100% quality will result in a reduction in image quality after multiple times because the compression algorithm is applied again and again on the same image. . But this change may not
Portable Network Graphics is also a raster image format that has been around since 1995. It is different from JPEG in that it is a lossless format and is currently the most common lossless
8-bit files can use a palette-based color model (also known as indexed color) - meaning the file can be smaller if the number of colors is reduced;is a complex picture, you still need to use PNG, because picture transparency cannot be achieved in JPEG.
- PNG compression is 25% more efficient than GIF
- 2D interlaced — the image is displayed progressively during loading, rather than only when the image is fully loaded. You must use this option with caution as it increases file size.
- Uses of PNG
PNG is great for line drawings, LOGOs, icons and images with less color. Photos and images with complex colors will generate huge files using the PNG format. Another advantage of PNG is that it supports transparent backgrounds. In this case, even if
PNG can be used well for line works, logos and icons.
Compress PNG
Because the compression algorithm in PNG is lossless, you can selectively reduce its colors and thus reduce the image through external tools size.
Graphics Interchange Format is also a bitmap format and appeared earlier than the other formats mentioned in this article. It was created by Steve Wilhite in 1989 and was the most popular 8-bit image format until PNG was created. GIF has similar characteristics to PNG, but has some disadvantages:
Uses of SVG
SVG is widely used in line art, logos, icons, illustrations and data visualization. But it is not suitable for realistic images and complex pictures with many details. In some cases, both SVG and PNG serve the same purpose well. For line art, SVG generally produces smaller file sizes. But this is not inevitable. Depending on how many anchor points the vector image has, it may even generate a larger file than PNG. Where SVG really excels is in data visualization. Since vector animations can be manipulated and created using JavaScript, libraries like D3 offer endless possibilities.
#point. In Sketch, be careful not to use unnecessary folders as they will also be saved as extra tags in the SVG.
Cleaning up unnecessary nodes is one way to reduce the size of SVG.
Element tags are all content contained within an SVG file, including opening and closing tags. Vector editing software such as Adobe Illustrator and Sketch may litter SVG with unnecessary elements and attributes. SVG compressor can be used to remove this redundant information.
The above is the detailed content of How to perfectly use graphic formats such as JPG on the web. For more information, please follow other related articles on the PHP Chinese website!