Kingfisher: UIImage.kf.tinted(with: .white) makes full image white

Created on 18 Aug 2017  路  2Comments  路  Source: onevcat/Kingfisher

UIImage.kf.tinted(with: .white) makes full image white in spite of transparency in image

Most helpful comment

I don't think the tinted processor works as one would expect. In the source code, it says it only works with CG-based images. For everything else, I had to do the following to get tinted colours to work:

UIImageView.kf.setImage(
  with: urlResource,
  completionHandler: { (image, error, cacheType, imageUrl) in
    self.tintColor = myTintColor
    self.image = self.image?.withRenderingMode(.alwaysTemplate)
  }
)

All 2 comments

I don't think the tinted processor works as one would expect. In the source code, it says it only works with CG-based images. For everything else, I had to do the following to get tinted colours to work:

UIImageView.kf.setImage(
  with: urlResource,
  completionHandler: { (image, error, cacheType, imageUrl) in
    self.tintColor = myTintColor
    self.image = self.image?.withRenderingMode(.alwaysTemplate)
  }
)

Maybe you need BlendImageProcessor?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

damirstuhec picture damirstuhec  路  3Comments

SURYAKANTSHARMA picture SURYAKANTSHARMA  路  4Comments

sindresorhus picture sindresorhus  路  3Comments

freak4pc picture freak4pc  路  3Comments

Minitour picture Minitour  路  4Comments