PHP converts a JPEG image to ProgressiveJPEG. The JPEG file format can be saved in two ways. They are BaselineJPEG and ProgressiveJPEG. the two formats have the same size and image data, and their extensions are the same. The only difference is that JPEG file formats have two storage methods. They are Baseline JPEG and Progressive JPEG.
The two formats have the same size and image data, and their extensions are the same. The only difference is that they are displayed differently.
Baseline JPEG
This type of JPEG file is stored in the JPEG file by scanning from top to bottom. When you open this file to display its content, the data will be displayed from top to bottom lines in the storage order until all the data is read, the entire image is displayed. If the file is large or the network download speed is slow, the image is loaded by one row. this format of JPEG has no advantages. Therefore, Progressive JPEG is generally recommended.
Progressive JPEG
Unlike Baseline, the Progressive JPEG file contains multiple scans. these scans are stored in JPEG files. When opening a file, the blurred outline of the entire image is displayed first. as the number of scans increases, the image becomes clearer and clearer. The main advantage of this format is that when the network is slow, you can see the picture outline to know what the picture is being loaded. When some websites open large images, you will notice this technology.
If your network speed is the same as that of snails, you can see the effect. In fact, you will often see this effect on large websites such as qzone and Weibo.
PHP code can also be converted to Progressive jpg.
The code is as follows:
<? Php
$ Im = imagecreatefrom#('file.jpg ');
// Sets the line-through-line scan to set the line-through-line scan bit mark. If the image is in JPEG format, the image is created as progressive JPEG. Php Manual
Imageinterlace ($ im, 1 );
Imagejpeg ($ im, './outfile.jpg', 80 );
Imagedestroy ($ im );
?>
How can I see whether the image is in the Progressive or Baseline format?
I currently know that I use the identity command in the ImageMagick software to view image resources.
The code is as follows:
Identify-verbose outfile.jpg
If you see an image with the attribute "Interlace: JPEG", it is a sive ssive image.
Bytes. They are Baseline JPEG and Progressive JPEG. the two formats have the same size and image data, and their extensions are the same, the only difference...