Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am making a Chat application for image sending and downloading. I want to do some animation like in WhatsApp. So, how to show the blurred image? My image is downloaded from server. Please help me.

like image 314
Bittoo Avatar asked Feb 08 '16 10:02

Bittoo


Video Answer


2 Answers

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.

like image 180
EvilTak Avatar answered Sep 16 '22 22:09

EvilTak


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!!

like image 34
Omal Perera Avatar answered Sep 18 '22 22:09

Omal Perera