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