pinterest / PINRemoteImage

A thread safe, performant, feature rich image fetcher
Apache License 2.0
4.01k stars 511 forks source link

Question: Progressive JPEG vs WebP vs URLs of varying quality #209

Closed oferRounds closed 8 years ago

oferRounds commented 8 years ago

Hi First of all - thanks for this really really amazing library!

I'd like to ask a question please: In my app most of image are ones which are uploaded by the client - via the users themselves. I would like to use one of options which are supported by this library for combatting slow connections.

My question relates to the fact that I'm not sure which of the 3 options would work out best for me. I searched on Google, but could not find a good compression of all 3.

Would love if someone would be able to explain the advantages & disadvantages of each method.

Thanks!

garrettmoon commented 8 years ago

WebP is more expensive to decode on device because there's no dedicated hardware. I think WebP may have a progressive option, but PINRemoteImage doesn't support it. Smaller download than JPEG, but bigger on device cost. Choosing this over JPEG depends on the network conditions of your users and the types of device they predominantly use.

Progressive JPEG is pretty awesome.

URLs of varying quality could be used in conjunction with progressive JPEGs. The idea behind it is to download a different version depending on network conditions. You'd still benefit from progressive.

oferRounds commented 8 years ago

@garrettmoon - thanks for your detailed answer!

One last question - does every JPEG supports Progressive, or when I encode and upload the image it should already be done for that purpose (i.e., in the way which supports it)?

garrettmoon commented 8 years ago

@oferRounds not every JPEG supports progressive, it depends on how it's encoded.

oferRounds commented 8 years ago

Got you - thanks again!