iphone - UIImage from image picker blurry -
i know question has been asked quite few times can't figure out why uiimage still blurry.
what i've done:
- import image uiimagepicker.
- resized image according code here: http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
- initialised uiimage initwithimage hold uiimage. added subview, made frame cgrectintegral(frame) ensure frame's coordinates integers.
despite this, uiimage appears on screen still bit blurry. ideas i'm doing wrong?
code:
uiimage *gotimage = [info objectforkey:uiimagepickercontrolleroriginalimage]; float scale = (self.view.frame.size.width)/(imagetoresize.size.width); imagetoresize = [imagetoresize resizedimage:cgsizemake(scale * imagetoresize.size.width, scale * imagetoresize.size.height) interpolationquality:kcginterpolationhigh]; uiimageview *background = [[uiimageview alloc] initwithimage:imagetoresize]; background.contentmode = uiviewcontentmodescaleaspectfit; background.frame = cgrectintegral(background.frame); [self.view addsubview:background];
you might attempt set rasterization on uiimageview layer.
reason being, you're picking original image, depending on device can 1000s of pixels. squishing down using aspect fit. there no rasterization smooth out image.
thats guess. without device info question kind of tough answer.
Comments
Post a Comment