Search code examples
iosswiftalamofire

Alamofire Image blurry Swift


I am resizing an image in a tableView cell and it is comming up very blurry.

let filter = AspectScaledToFillSizeFilter(size: imageView.frame.size)
messageImage.af_setImage(withURL: messageImageDownloadUrl! as URL, filter: filter, imageTransition: .crossDissolve(0.2))

How can I fix the blur?


Solution

  • You should not be mixing both an AspectScaledToFillSizeFilter and a contentMode of AspectFill together. You also shouldn't need to ClipToBounds. I'd recommend setting the contentMode to .Center.