nicklockwood / FXBlurView

[DEPRECATED]
Other
4.94k stars 713 forks source link

UIImage.blurredImageWithRadius() failed for some of the images. #129

Closed ansonyao closed 5 years ago

ansonyao commented 8 years ago

I am using this UIImage.blurredImageWithRadius() to add blur effect. It works well for most of my images. However, for some of images, an error is shown in XCode as

CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details

CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

CGContextSetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

CGContextFillRects: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

Anyone has similar issue and how to solve it?

tlkahn commented 8 years ago

Try add the following in FXBlurView.m after line 107 and line 120:

  if (!context) {
        if (unsupportedColorSpace){
            CGColorSpaceRelease(colorspaceRef);
        }
        return image;
    }

If it helps, please let me know. I will post a pull request based on this issue.

Slangen commented 8 years ago

I'm having the same issue but i'm not quite sure how that code should help tlkahn? There's is no variable context (ctx is there). What is unsupportedColorSpace? There is no variable colorspaceRef.

Any other ideas on how to fix this issue? I'm desperate

ansonyao commented 8 years ago

First make sure your image size is reasonable. I finally avoid calling this function and put a blur view on top of the image. There are also sample code of blur method by apple which is not crashing.

On Wednesday, 31 August 2016, Magnus Söderlund notifications@github.com wrote:

I'm having the same issue but i'm not quite sure how that code should help tlkahn? There's is no variable context (ctx is there). What is unsupportedColorSpace? There is no variable colorspaceRef.

Any other ideas on how to fix this issue? I'm desperate

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicklockwood/FXBlurView/issues/129#issuecomment-243766227, or mute the thread https://github.com/notifications/unsubscribe-auth/ABL5VyhGyw62uAb_kDsVU33fiiD3b2tZks5qlYOzgaJpZM4I_vAA .

On Wednesday, 31 August 2016, Magnus Söderlund notifications@github.com wrote:

I'm having the same issue but i'm not quite sure how that code should help tlkahn? There's is no variable context (ctx is there). What is unsupportedColorSpace? There is no variable colorspaceRef.

Any other ideas on how to fix this issue? I'm desperate

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicklockwood/FXBlurView/issues/129#issuecomment-243766227, or mute the thread https://github.com/notifications/unsubscribe-auth/ABL5VyhGyw62uAb_kDsVU33fiiD3b2tZks5qlYOzgaJpZM4I_vAA .

Slangen commented 8 years ago

After resizing my image i got the blur-effect working. However. One of my images blur very nicely towards the tinted color provided while the other (the one that initially was to big and caused the same error that got me here) wont tint towards any color. Its an image with mostly white in it, our worst case scenario and i need it tinted towards green. Any ideas?

I read up on apple's methods and those wont be a perfect fit for our needs seeing that they cant tint towards our desired color.