How to quickly display homepage images

Source: Internet
Author: User

This article describes six ways to speed up the display of web pages. The most basic purpose is to let you buy fish and taste the delicious food and nutrition of the bear's paw.

1. First, determine the image format. This is very important. In HTML files, use *. Jpg and ,*. Gif ,*. Bmp and other file formats can be browsed. We only select the first two types, because these two file formats can compress images to a large extent, so that the same visual effect can be produced, the size of image files is much smaller. But do we use JPG or GIF? If an image is input into a computer using a scanner (including a digital camera, of course), it is usually a photo of a person, a landscape, or something. This image uses a lot of colors, that is to say, the images are both light red, dark red, green, blue, yellow, etc. At this time, we should choose to use JPG format to store images. If the image is made by you using Photoshop, Paint Shop Pro, and other software, such as the title text, then the color used in the image is usually less, we can choose the GIF format. To know how many colors are used in the image, you only need to use the Paint Shop Pro software (the author uses Version 5.00) the "Color/Count Colors Used" function in gives you an accurate answer.

2. in the Color drop-down menu of the Paint Shop Pro software, there is also a "Decrease Color Depth" function, which is used to reduce the number of Colors used by the image, you can choose 16 Colors, reduce the number of colors used by the image to 16. When the number of colors is reduced, if you think the image quality does not change much, use the GIF format. You know, JPG format treats color images with 16 MB color.

3. If you think that the visual effect of the image becomes worse after the number of colors is reduced, and you cannot bear it, we will adopt JPG compression format. No matter what kind of graphics processing software is used, it will ask you about the JPG compression ratio when you save the disk. Of course, the harder the compression, the smaller the file, but the worse the image quality. Generally, the compression ratio from 50% to 70% is better (the larger the percentage, the smaller the file). When the compression ratio increases from 0% to 50%, the file size decreases sharply, however, the image quality does not change much. After the compression ratio is increased, the image will obviously deteriorate, but the size of the file will be greatly reduced, sometimes even dozens of bytes. But I want to tell you that there is no absolute situation in everything. How can you try it at this moment? The 256-color format stores images in GIF format, which is less than the number of bytes for JPG files and determines the image format.

We have mentioned almost all the methods for image weight loss. That is to say, the number of bytes of the image cannot be reduced. However, we can find a way for the viewer to wait patiently for all the images to come out when the image file is of a certain size. The method is to use the line-separated GIF and step-by-step JPG. An image file is displayed in the form of a line break. For example, if an odd number of rows are first displayed and then an even number of rows are displayed, the image becomes clearer. You can save an image file as an interlace GIF file by selecting "Interlaced" (do not select "Normal") in Photoshop and saving it in Paint Shop Pro, click "Option ..." Select "Interlaced" (do not select "Non Interlaced "). JPG files can be displayed in a fuzzy manner. As the image file data is continuously uploaded from the Internet, the image becomes clearer. The advantage of doing so is that the image can be displayed as soon as possible. Although the image is not perfect, the viewer can see the hope and the image is constantly improving. To save an image file as JPG, select Progressive when saving it in Photoshop. When saving it in Paint Shop Pro, click "Option ..." Click "Progressive encoding ".

5. There is also a way for the viewer to patiently wait for the image to be displayed, that is, preview the image. That is, before the source image is displayed, an image with a relatively small number of bytes and poor image quality is displayed. The viewer determines whether to browse the source image. Usually, the preview image is a version with low resolution and high compression ratio of the primary image. To preview an image, , where temp.gifis the source image, and prevIEw.gif is the preview image.

6. If you can achieve the expected purpose, try to make the image smaller. The smaller the image size, the smaller the number of bytes. When creating an image, try to remove useless information around the image. For example, if you make a very beautiful image with a black background and the background color of the webpage is black, at this time, you must try to fill up the entire image as much as possible. Do not make the black background border in the image too large, because the background color of the image will eventually be integrated with the background color of the web page, when the size of an image is fixed, the larger the image size, the larger the number of bytes of the image file. The more time it takes to transfer the image online. There is also *. When using images in HTML files, you can add the WIDTH and HEIGHT attributes, which respectively represent the WIDTH and HEIGHT of the images displayed on the page. It should be noted that the width and height are irrelevant to the size of the image itself. For example, you can go *. This example uses a x 31 image file logo.gif in the HTML file.</

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.