uiimageview - iOS: how to scale up image nicely? -


i'm having trouble scaling image in nice way. i'm displaying image in uiimageview. while image downloading server, i'd display blurred version of image. server gives me small version of image looks this:

small preview image

magnified, looks this:

large preview image

i'd able draw (which how chrome draws when scale image up):

chrome blurred image

but when put image uiimageview , set imageview.layer.magnificationfilter kcafilterlinear or kcafiltertrilinear, this:

uiimageview scaled image

... ugly - notice hard bands of light , dark.

i've tried using cifilter cilanczosscaletransform, , looks promising, ugly border effect:

lanczos scaled image

well - advice? done nicely? can try filters forever, thought i'd see if anybody's cracked this...

edit: tried bbarnhart's suggestion. - nicer, blur radius large or something:

visual effect blur

edit 2: @bbarnhart, can this, closer!

enter image description here

using blur effect on uiimageview might give closer want.

let blurview = uivisualeffectview(effect: uiblureffect(style: .light))     blurview.frame = yourimageview.bounds yourimageview.addsubview(blurview) 

also check out bluuur

update include playground:

import uikit import xcplayground  let image = uiimage(named: "pixels") let view = uiview(frame: cgrect(x: 0, y: 0, width: 346, height: 431)) let imageview = uiimageview(image: image)  let blurview = uivisualeffectview(effect: uiblureffect(style: .light)) blurview.frame = imageview.bounds imageview.addsubview(blurview)  view.addsubview(imageview) xcplaygroundpage.currentpage.liveview = view 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -