Kingfisher: "[Kingfisher] Failed to create CG context for blurring image."

Created on 18 Jan 2017  ·  12Comments  ·  Source: onevcat/Kingfisher

I am getting this assertion causing my app to crash line 479 of Image.swift. In log the following error was also visible before the assertion:

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

I have deleted the assertion and though I am not getting any blur, at least the app no longer crashes.

Most helpful comment

@onevcat
crash happens when the imageview size is zero also

All 12 comments

Hey.

It might be caused by some strange format of that image. May I know the image url (or the image itself) crashes your app? So I could have a look at what happen indeed.

Thanks.

Should be fixed in #567.

There are some other work to do before a new version could be released. I will tag it later ASAP.

@onevcat Tomorrow I migrate Kingfisher to 5.0, after I received this bug.

@onevcat Hello, I'm getting this issue on last Kingfisher 5.1.0

Same issue in here , while scrolling it getting crashed

@anhhtbk @salyasev @Eldhopj May I know what image causes this problem? Is there a link or an image I can use to reproduce this issue?

Same crash, but line 505 in ImageDrawing.swift.

It will happen when using DownsamplingImageProcessor while scrolling
Everything time it is crashed by a same png image, but I did not fine any abnormal for this image.

portrait_thumbnail

imageView.kf.setImage(
            with: viewModel.thumbnailURL,
            placeholder: nil,
            options: [
                .processor(DownsamplingImageProcessor(size: imageView.bounds.size)),
                .scaleFactor(UIScreen.main.scale),
                .cacheOriginalImage
            ])

After some investigation, the root cause is that for collectionview, cell can partially show up and actual imageView has not show up yet, but I really do not know why it only crash for the cell with same image.

@onevcat
crash happens when the imageview size is zero also

@seanliu1 Not quite sure about it. The image itself seems fine.

Is there any crash log for it?

@Eldhopj The crash of DownsamplingImageProcessor for zero or negative size should be already fixed in #1074, can you confirm that you are using the latest version?

This problem also occurs when using ResizingImageProcessor with a referenceSize of CGSize.zero

The ResizingImageProcessor should be failing with an assertionFailure, which is intended as a warning of incorrect usage of this API. It behaves as a reminder when developing, and will not crash in a release build.

Was this page helpful?
0 / 5 - 0 ratings