Title: Kingfisher 3.0 iOS swift RoundCornerImageProcessor white background
Tags: ios;swift;kingfisher
Question: This is the code that I am using to set the user image which works great to actually get and set the image. I get a white outline to the picture. Any idea how to make this transparent?
let processor = RoundCornerImageProcessor(cornerRadius: 50)
self.userPhoto.backgroundColor = Colors.accent
self.userPhoto.kf.setImage(with: url, placeholder: UIImage(named: "ic_camera_alt_48pt"), options: [.processor(processor)])
Example with 50
Comment: try         self.userPhoto.kf.clipsToBounds = true

Comment: The image has to be a PNG with alpha channel in order to achieve what you want.

Comment: @KKRocks I don't see clipsToBounds on kingfisher only the image. I tried             self.userPhoto.clipsToBounds = true with no luck.


Here is another answer: The format of the original image doesn't support transparency (i.e. JPEG). You must convert the image to one that does (i.e. PNG) prior to caching.
From the Kingfisher Cheat Sheet:
By default (DefaultCacheSerializer), Kingfisher will respect the input
image format and try to keep it unchanged. However, there are some
exceptions. A common case is that when you using a
RoundCornerImageProcessor, you may always want the alpha channel. If
your original image is jpg, you may want to set the png serializer
instead:
let roundCorner = RoundCornerImageProcessor(cornerRadius: 20)
imageView.kf.setImage(with: url,
options: [.processor(roundCorner),
.cacheSerializer(FormatIndicatedCacheSerializer.png)]
Comment for this answer: This is accepted answer, and just an addition, you may have to use clipToBounds=true on your UIImageView if you're using ResizingImageProcessor along with RoundCornerImageProcessor.

Here is another answer: You don't need the RoundCornerImageProcessor
self.userPhoto.layerCornerRadius = 50
self.userPhoto.clipsToBounds = true
self.userPhoto.backgroundColor = Colors.accent
self.userPhoto.kf.setImage(with: url, placeholder: UIImage(named: "ic_camera_alt_48pt"))

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:06/21/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<ios><swift><kingfisher>', 'Title': 'Kingfisher 3.0 iOS swift RoundCornerImageProcessor white background', 'ViewCount': 1961, 'id': 44675108, 'user_AboutMe': '<p>BY DAY: ABAP, SAP guru\nBY NIGHT: Struggling Web Developer (or should I say constantly learning) :D</p>\n', 'user_AccountId': 3236609.0, 'user_DisplayName': 'ajonp', 'user_Reputation': 111.0, 'user_Views': 10.0, 'user_id': 2730656.0}}