UICollectionView + WebP w/SDWebImage
pod 'SDWebImage/WebP'
provides the easiest way to handle WebP image, as easy as JPEG.
Just use provided UIImageView extension imageView.setImageWithURL(NSURL(string: "http://path/to/image.webp"))
to handle WebP.
The example shows number of same WebP image (2642 bytes) with cache-preventing hack. To provide same size/quality JPEG image, its size goes to 12,016 bytes. (approximately 5x)
Please note while you are scrolling down, images will be loaded from network, not from local disk.
- WebP: http://d3lncrho1w0yzl.cloudfront.net/photo1.100x133.2642bytes.webp (2642 bytes)
- JPEG: http://d3lncrho1w0yzl.cloudfront.net/photo1.100x133.jpg (12,016 bytes)
#Note
- Performance.
- As WebP needs software decoding, decoding overhead gets longer than JPEG's.
- For smaller sized images, decoding overhead seems to be longer than network overhead.
- For bigger sized images, network overhead will get enough to consider WebP? It needs further research.