how to sharp/blur an uiimage in iphone?

前端 未结 4 450
傲寒
傲寒 2020-12-19 19:15

I have a view with UIImageView and an UIImage set to it. How do I make image sharp or blur using coregraphics?

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 19:52

    What you really need are in the image filters in the CoreImage API. Unfortunately CoreImage is not supported on the iPhone (unless that changed recently and I missed it). Be careful here, as, IIRC, they are available in the SIM - but not on the device.

    AFAIK there is no other way to do it properly with the native libraries, although I've sort of faked a blur before by creating an extra layer over the top which is a copy of what's below, offset by a pixel or two and with a low alpha value. For a proper blur effect, tho, the only way I've been able to do it is offline in Photoshop or similar.

    Would be keen to hear if there is a better way too, but to my knowledge that is the situation currently.

提交回复
热议问题