UIImage resizing blurs

Hi all,



I'm having an issue resizing an image downloaded from my server.

On My server I have assets for my app I can't put in the app bundle as those images are dynamicly change.

The images on the server are all fit to @3x sizes so I need to rescale them to fit regular retina and non retina (are there still any of those today?) programmatically.



The image giving me a hard time is an image I need to put on a UISlider thumb. When I'm trying to resize the image down to @2x it becomes blurry.

I tried the following options:

UIGraphicsBeginImageContextWithOptions and then CGContextDrawImage (of course with the full code with interpolation etc.).

CGBitmapContextCreate also with CGContextDrawImage.

But, nothing helps.

Just for testing I put an UIImageView with the image downloaded and view content as aspect fit and it looks great, but I can't use image view inside the thumb of a slider.

I tried all written in here, here and here (Last one from NSHipster I tried only Core Graphics).



I really need your help.



Thanks.

Accepted Reply

Thats true I guess.

But I also found out that there is a bug in the slider thumb and it will always be blurred for big images. Putting the same scaled image into a regular UIImageView works great.

Replies

Resizing a 3x image to 2x is going to go what is generally considered one of the worst looking rescales in the business 🙂.


You would be better off having 2x (and possibly 1x) images on your server and vending the correct ones, rather than resizing the 3x images down.

Thats true I guess.

But I also found out that there is a bug in the slider thumb and it will always be blurred for big images. Putting the same scaled image into a regular UIImageView works great.