Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show blurred thumbnail before downloading the whole image (like in Whatsapp)?

Tags:

android

image

I am trying to get the same nice UI effect guys at Whatsapp did. Each time I receive some image, not matter of its size, I can see blurred thumbnail in a matter of 1 sec, and over it an indicator that the real image is being downloaded.

How do they do this? I want to achieve the same effect when users download images from our server. I am not sure if they are doing some server-side image processing, or there is a built-in feature in Android SDK which can do this.

Let's say a user requests an image of 4MB. Almost instantly he clicks download, a blurred thumbnail of the image will appear over the screen and download status indicator over it. I am mainly interested how to get image preview so quickly, literally in a matter of 1 sec (feels like being instantly).

PS. Similar effect has StackOverflow when you try to upload an image. When you drag it to the upload popup, you see its preview almost instantly. I guess Stackoverflow does this by using client side scripting, which we cannot apply in Android app. But this is a good showcase of what I need (in case you don't use Whatsapp).

like image 508
sandalone Avatar asked May 23 '14 04:05

sandalone


People also ask

How can I download a blurry picture on WhatsApp?

A photo might appear blurry if WhatsApp can no longer find it in your device or SD card. This usually happens if the photo is deleted. To automatically save photos to your device: Android: Open WhatsApp > Tap More options > Settings > Chats > Turn on Show media in gallery.

Why is YouTube thumbnail blurry in WhatsApp?

The burred images you see are thumbnails created by WhatsApp when the image is uploaded. Before sending the actual picture, WhatsApp sends only these thumbnails to the receiver. These thumbnails are created using advanced image compression techniques and the size of the image may be reduced to 1 KB or less.

Why thumbnail is not showing in WhatsApp?

The most common issue with Quick Links not rendering thumbnail previews in WhatsApp is the image file size being too large. Although Facebook supports the display of Open Graph images up to 8 MB in size, their WhatsApp product appears to have different, undocumented size limitations.

What does thumbnail mean on WhatsApp?

"Small version of a picture" is the most common definition for THUMBNAIL on Snapchat, WhatsApp, Facebook, Twitter, Instagram, and TikTok. THUMBNAIL.


2 Answers

Basically what is happening in these situations is you need to request a blurred thumbnail from the server (Usually very small so it downloads quickly), and then begin the download of the full image. This is something that has to be done by the server.

Update: You can now use a technology like progressive jpeg to achieve the same effect without having your server store two separate images. Progressive jpegs basically encode a very low quality image in the first bytes of an image, and then as the image continues to load the quality improves. This may not be the exact effect you are looking for, but it should be able to show a quick low quality preview while loading in the full sized image. Currently the only way to load these on Android is with Facebook's Fresco library.

like image 193
Alex Avatar answered Oct 17 '22 10:10

Alex


I have another theory. I think the method used here is that before publishing the message, they have some algorithm to generate a lightweight fuzzy low-quality picture (in the sender) and then send the contents of that array (a few bytes as a byte[] array maybe) along the published message .. now once the receiver receives the message, he can instantly display that fuzzy image and get the full image by doing a full request to the server .. What makes me think this is that if they are going to request the thumbnail from the server then why not have a detailed thumbnail ? it can be small in size as well .. why have a fuzzy thumbnail that is only a mere shallow representation of the original one and not complete like thumbnails we see in the web.

like image 7
Mohammad Zekrallah Avatar answered Oct 17 '22 08:10

Mohammad Zekrallah