如何对图像应用模糊,然后用 Kingfisher 缓存它?
How to apply blur to image and then cache it with Kingfisher?
我正在尝试从 URL
下载图像,对其进行模糊处理、缓存,然后将其显示在 table 视图单元格中。
我这样做了:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
backgroundImageView.kf.setImage(with: resource)
backgroundImageView.image = backgroundImageView.image?.kf.blurred(withRadius: CGFloat(7.6))
但这意味着我会在将图像设置为我不想要的图像视图后模糊图像。
有什么建议么?谢谢!
找到解决方案:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
let processor = BlurImageProcessor(blurRadius: 4)
backgroundImageView.kf.setImage(with: resource, placeholder: nil, options: [.processor(processor)], progressBlock: nil, completionHandler: nil)
我正在尝试从 URL
下载图像,对其进行模糊处理、缓存,然后将其显示在 table 视图单元格中。
我这样做了:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
backgroundImageView.kf.setImage(with: resource)
backgroundImageView.image = backgroundImageView.image?.kf.blurred(withRadius: CGFloat(7.6))
但这意味着我会在将图像设置为我不想要的图像视图后模糊图像。 有什么建议么?谢谢!
找到解决方案:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
let processor = BlurImageProcessor(blurRadius: 4)
backgroundImageView.kf.setImage(with: resource, placeholder: nil, options: [.processor(processor)], progressBlock: nil, completionHandler: nil)