-
Notifications
You must be signed in to change notification settings - Fork 152
Lots of invalid context 0x0 errors #1
Comments
Can you upload a sample image that causes this error please? I'll see what I can do about getting a fix pushed up. |
It's an image that I have within my app bundle (the placeholder/default images). I will email a few of them to you. They're pretty small (50x50 png source). This seems to be the source of all the grief: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; kCGImageAlphaLast; 224 bytes/row. I've sent the image (and its 2x counterpart) your way, along with code snippets! |
More info! Looks like CGImageGetBitmapInfo returns 3 (instead of 2) for my default images. For the record, it's 8 bits per component, 3 components, color space model 1, and then bitmap info is usually 2, but sometimes 3 (for the default images). Now, kCGBitmapFloatComponents is 256, and kCGBitmapAlphaInfoMask is 31 ... so this 2/3 is just alpha info ... and thus we come to CGImageAlphaInfo: 2 = kCGImageAlphaPremultipliedLast. The alpha component is stored in the least significant bits of each pixel and the color components have already been multiplied by this alpha value. For example, premultiplied RGBA. 3 = kCGImageAlphaPremultipliedFirst. The alpha component is stored in the most significant bits of each pixel and the color components have already been multiplied by this alpha value. For example, premultiplied ARGB. Hmm ... I sure hope I deduced all that correctly! Not that I know why one-vs-the-other is not good (I don't). Another update: It didn't matter. Turns out that my 50x50 icon has alpha already applied (it no longer needs to be, so I will swap that out), but the 100x100 does NOT have alpha applied ... so bitmap info is 2 for that ... and we still get that error. Curiouser and curiouser ... Per Table 2-1, Pixel formats supported for bitmap graphics contexts, kCGImageAlphaLast is not supported along with 8 bpc and 32 bpp. Hmph. Now how'd my images get THAT way? :) |
Eureka! See this SO item, in particular the normalize method. Once I added that to UIImage+Common, then called it up-front in the various helper methods, all the errors went away! The only other problem now is what to do about the 2x vs 1x images. I can see in the simulator that the 1x images are being used even when in Retina mode. According to one of the comments over on Björn's blog, "Great code, but it scales down retina graphics to regular resolution." Eek. :( |
Any news on this issue? My xcode log screen - http://screencast.com/t/tdaUQu92SxqF I have this errors only running on simulator. |
Any ideas? (Note: I've disabled ARC for these three method files, though the app I'm writing uses ARC.)
Seems to happen after I call -thumbnailImage:transparentBorder:cornerRadius:interpolationQuality:.
The text was updated successfully, but these errors were encountered: