yeatse / KingfisherWebP

Elegantly handle WebP format with Kingfisher.
MIT License
304 stars 73 forks source link

UICollectionView with WebP images is not smooth when scrolling. #80

Open Bone-Song opened 6 months ago

Bone-Song commented 6 months ago

Hello. UICollectionView with WebP images is not smooth when scrolling. This issue was fine until version 1.5.1, but starting from version 1.5.2.

Please check the sample app I created. -> https://github.com/Bone-Song/LibTest/tree/2b2f66ef8065855ac1e699ea3fb2a65f0b1b60fb/KingfisherWebPTest

Please let me know if there are any changes in using KingfisherWebP. I hope solves this issue. thank you.

yeatse commented 6 months ago

In version 1.5.2, we revised the processing logic for animated images to accurately manage frames with varying durations, ensuring images are optimally displayed in AnimatedImageView for enhanced performance. You can find details in the release notes here: 1.5.2 - Progressive Animation.

After reviewing your sample app, I observed the performance drop you mentioned. I'll investigate into it later. For now as a workaround, you could improve the UI’s smoothness by replacing UIImageView with AnimatedImageView in your Main.storyboard, or changing callbackQueue to a global queue when setting images:

imageView?.kf.setImage(with: URL(string: urlStr), options: [.callbackQueue(.dispatch(.global()))]) { result in
    // debugPrint...
}