A way to implement picture loading from blur to clear display

Source: Internet
Author: User
Tags transparent image

1. Control by code

QQ album Some of the recent optimization methods to solve the appeal of the two methods of the shortcomings and meet the needs of users to view the photo: The first time to see the picture of the situation and as soon as possible to see the clear original. This method uses thumbnails and original artwork to load and overlay the display at the same time, load the thumbnail and pull the large display, the large image superimposed on the thumbnail and loaded at the same time. Thumbnails are small and often quickly give users the effect of blurred images, the large image loading process from the top down to gradually overlay the thumbnail, so that users can see the loading process of the large map.

As shown above, the processing steps of this method are:
1). Get the photo thumbnail and the original image URL to get the photo's length and width;
2). Load and display the thumbnail image, the thumbnail in accordance with the length and width of the film display, when the user sees a blurred effect;
3). Load and display the original picture, overlay the original image above the thumbnail display, the original picture load how much to show how much, not loaded or show thumbnails, gradually the thumbnail overlay, the original image in the process of loading the image from the blur to a clear gradient effect.
4). When the original picture is loaded, the original image is all covered by the thumbnail, when the user sees the actual original. You can hide thumbnails to prevent thumbnails from interfering with transparent image displays such as PNG or GIF.

<!--设置照片的大小--> < div style = "width:400px;height:300px;" >      <!--小图拉大显示-->      < img src = "small_url" style = "width:100%;height:100%;" />      <!--原图叠加在小图上面-->      < img src = "big_url" style = "width:100%;height:100%;position:absolute;top:0px;left:0px;" /> </ div >2. Create C # with progressive JPEG via the image itself's loading style:
Using (ImageSource= Image.FromFile(@"D:\temp\test2.jpg")) { ImageCodecInfoCodec= ImageCodecInfo.Getimageencoders().First(C=C.MimeType == "Image/jpeg"); EncoderParametersParameters= New EncoderParameters(3);Parameters.Param[0] = New Encoderparameter(System.Drawing.Imaging.Encoder.Quality, 100L);Parameters.Param[1] = New Encoderparameter(System.Drawing.Imaging.Encoder.Scanmethod, (Int)Encodervalue.scanmethodinterlaced);Parameters.Param[2] = New encoderparameter (system drawing. Imaging. Encoder. Rendermethod,  (intencodervalue. Renderprogressive Source. Save (@ "D:\temp\saved.jpg" , Codec, Parameters               /span>                

Implement image loading from blur to clear display

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.