How to show Blurred image before downloading(like in whatsapp) in ios?

一世执手 提交于 2019-12-05 11:20:41

Scale the image down to a very small size like say 8x8 pixels. Send that data to the client. It should not be more than 4 * 8 * 8 = 256 B or 0.25 KB in size, so sending it to the client will not be a problem no matter how slow the client's connection speed is.

Then scale the received 8x8 image to the resolution of the preview box (e.g. 256x256). You shouldn't need to upsample the 8x8 image if the preview box is a UIImageView (see the link below). This downsampling and successive upsampling of an image "blurs" the image.

To understand how you can resample/rescale an image in iOS, check this link. I am not an iOS developer and cannot help you much in performing this task specifically for iOS.

Omal Perera

I think that process is done using the server... As I know, there are 2 copies for a single image..

  • one image with full quality
  • other image is a thumbnail of original image.. (low size in capacity )

So.. before downloading the original picture client app calls for the URL of the thumbnail & it downloads very quickly since its size is less.. Meanwhile you can use an async function to download original file in the same time..

That is the process...

Hope it will be help for you!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!