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:
magnified, looks this:
i'd able draw (which how chrome draws when scale image up):
but when put image uiimageview , set imageview.layer.magnificationfilter kcafilterlinear or kcafiltertrilinear, this:
... ugly - notice hard bands of light , dark.
i've tried using cifilter cilanczosscaletransform, , looks promising, ugly border effect:
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:
edit 2: @bbarnhart, can this, closer!
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
Post a Comment