ApplyBlurWithRadius works on iPhone 6, not 6+ (UIImage + ImageEffects)

I'm using Apple UIImage+ImageEffects

from WWDC (2013?)

This method works great on iPhone 6, but produces a really weird jagged, oversaturated image on iPhone 6 Plus:

[self applyBlurWithRadius:60 tintColor:[UIColor colorWithWhite:1.0 alpha:0.3] saturationDeltaFactor:2.4 maskImage:nil];


iPhone 6 (correct):

enter image description here

iPhone 6 Plus (weird):

enter image description here

Any idea what's going on?

Update: I determined through trial and error that setting blurRadius to anything less than or equal to 50 shows OK, so it is related to radius. I would still like to know what exactly makes it peek at the big screen.


source to share

1 answer

I know this question is old and the OP has moved on since then, but I would like to explain why it is different on every phone ... for future generations.

iPhone6 ​​and iPhone6 ​​+ have different screen resolutions. Basically, the iPhone6 ​​has a scale of 2.0, while the iPhone6 ​​+ has a scale of 3.0.

Why does it matter?

In the source code applyBlurWithRadius

in the source file UIImage+ImageEffects.m

you will find the following lines:

CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale];
uint32_t radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5);
if (radius % 2 != 1) {
    radius += 1; // force radius to be odd so that the three box-blur methodology works.


You can see what inputRadius

will differ depending on the screen scale. So on iPhone6 ​​this value will be 60*2

(end result for radius

will be: 227), and on iPhone6 ​​+ the value will be 60*3

(end result for radius

will be 339). This will obviously lead to different results as they are different values.

What about the color difference? I'm pretty sure I radius

shouldn't exceed 255, otherwise undefined results might occur (possibly an integer overflow causing color components to zero to zero). Since the iPhone6 ​​+ screen scale value pushes it above this value, you see strange results, but not on the iPhone6 ​​as it is below this threshold.

You should see the same weirdness on iPhone6 ​​using 90 for the parameter blurRadius


Side note: you don't need values ​​higher than 30 for the parameter anyway blurRadius

- the results won't be much different from that point.

Hope this helps you.



All Articles