Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error message in console: "<Error>: CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details" #35

Closed
vkaramov opened this issue Oct 29, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@vkaramov
Copy link

I've found the same issue that SDWebImage had. When trying to show image like that http://7xngft.com2.z0.glb.qiniucdn.com/thn.jpg I've got an error message:

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

After setting CGBITMAP_CONTEXT_LOG_ERRORS environment variable, I got more detailed info:

:
CGBitmapContextCreate: unsupported parameter combination:
16 integer bits/component;
64 bits/pixel;
RGB color space model; kCGImageAlphaLast;
1760 bytes/row.
Valid parameters for RGB color space model are:
16 bits per pixel, 5 bits per component, kCGImageAlphaNoneSkipFirst
32 bits per pixel, 8 bits per component, kCGImageAlphaNoneSkipFirst
32 bits per pixel, 8 bits per component, kCGImageAlphaNoneSkipLast
32 bits per pixel, 8 bits per component, kCGImageAlphaPremultipliedFirst
32 bits per pixel, 8 bits per component, kCGImageAlphaPremultipliedLast
64 bits per pixel, 16 bits per component, kCGImageAlphaPremultipliedLast
64 bits per pixel, 16 bits per component, kCGImageAlphaNoneSkipLast
128 bits per pixel, 32 bits per component, kCGImageAlphaNoneSkipLast |kCGBitmapFloatComponents
128 bits per pixel, 32 bits per component, kCGImageAlphaPremultipliedLast |kCGBitmapFloatComponents
See Quartz 2D Programming Guide (available online) for more information.

Environment: iOS 9.0 simulator, Xcode 7.1.

vkaramov pushed a commit to vkaramov/Nuke that referenced this issue Oct 29, 2015
@vkaramov vkaramov mentioned this issue Oct 29, 2015
@kean
Copy link
Owner

kean commented Oct 30, 2015

screen shot 2015-10-30 at 21 43 24

@kean
Copy link
Owner

kean commented Oct 30, 2015

64 bpp, 16 bpc, kCGImageAlphaLast (what image data tells us) is not supported
64 bpp, 16 bpc, kCGImageAlphaPremultipliedFirst (that I mention in a PR) is not supported either

As far as I can tell we should simply draw all images using the same pixel format which is best for rendering (for instance, 32 bbp, 8 bpc, kCGImageAlphaPremultipliedLast). End users should be able to easily alter this behaviour by implementing custom image decompressors.

@kean
Copy link
Owner

kean commented Oct 30, 2015

// See Quartz 2D Programming Guide for more info
guard let contextRef = CGBitmapContextCreate(nil,
    Int(imageSize.width),
    Int(imageSize.height),
    8,
    0,
    CGColorSpaceCreateDeviceRGB(),
    CGImageAlphaInfo.PremultipliedLast.rawValue) else {
        return image
}

screen shot 2015-10-30 at 22 05 44

@kean kean closed this as completed Oct 30, 2015
@kean kean added the bug label Oct 30, 2015
@kean kean added this to the 1.0.1 milestone Oct 30, 2015
@kean kean self-assigned this Oct 30, 2015
@sadityam
Copy link

sadityam commented Dec 2, 2015

Hi,

How did you set the environment variable CGBITMAP_CONTEXT_LOG_ERRORS and what did you set it to ?

-Thanks

@vkaramov
Copy link
Author

vkaramov commented Dec 2, 2015

Product/Scheme/Edit Scheme/Environment variables.
I had set it to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants