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.
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.
I think that process is done using the server... As I know, there are 2 copies for a single image..
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!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With