It's easy to understand, so I won't translate it here. Here we will summarize: image compression is actually very simple. Remove unnecessary parts and select a suitable storage format to compress according to the image quality requirements (For details, refer to section 2 and section 2 ).
Author:Susie Sahim, web designer and Google doodler
Recommended skills: basic image manipulation
When you optimize every line of code for your website, don't forget about your static content-including images. simple improvements can drastically decrease your download size, without diminishing the site's quality.
Here are a few tips to help you make your web graphics Load faster
Crop out excess white space
Sometimes you have extra space or padding around graphics so that they don't touch accompanying text or web page elements. Instead, crop out that space and use CSS to create the padding around the graphic.
Use the best File Format
For images containing flat strstrations or artwork, use the 8-bit PNG or GIF format and reduce the number of colors in the palette. some image programs such as PhotoShop allow you to save the image for the web and fine-tune the image settings. by grouping the color palette from 256 to something like 32, you greatly reduce the size of the file. the less colors that the image has, the smaller the file size is going to be.
For very detailed and colorful artwork or for photographics, JPG and 24-bit PNG are typically used because they have a much larger color palette. while a 24-bit PNG results in superior image quality, this comes at the price of a larger file size. when you can, use JPG instead and adjust the quality setting so you can compress the image as much as possible within your desired tolerance for image quality.
To compare and contrast, here are the file sizes of the above graphic in various formats:
- JPG, 60 quality-32 K
- PNG-8, 256 colors-37 k
- GIFs, 256 colors-42 K
- PNG-24-146 K
Also note that JPG has an option called "progressive" mode. this option adds multiple copies of the image at lower resolution to make the image appear quickly on the screen, while progressively improving in quality. but it also increases the overall size of the image.
PNG also has a similar feature called "interlaced". You may be able to turn this feature off so that the full image downloads quicker.
Because the 8-bit PNG and GIF formats have the potential to result in much smaller image files, try to keep this in mind when creating graphics and other strations for your site. try to keep the amount of colors to a minimum and use flat graphics instead of photographs. this way you can create images with palettes of 16 colors, keeping the file size extremely small and fast to download.
This article uses b3log solo for Synchronous publishing from Vanessa. Original address: http://vanessa.b3log.org/Optimizing-web-graphics