Skip navigation
This discussion is archived

quicklookd[516] <Error>: CgBI: unknown critical chun

4325 Views 3 Replies Latest reply: Apr 25, 2009 6:32 PM by Planet9 Dave RSS
BlackFrog Level 1 Level 1 (20 points)
Currently Being Moderated
Apr 14, 2009 6:27 PM
Does anyone have an idea why these errors are appearing in my log? And what does quicklook have to do with my Comcast connect? I just to switch to cable from dsl and I do not remember seeing these errors before.

4/14/09 6:42:51 PM com.apple.quicklook[47269] Tue Apr 14 18:42:51 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[47269] <Error>: CgBI: unknown critical chun
4/14/09 6:42:51 PM com.apple.quicklook[47269] Tue Apr 14 18:42:51 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[47269] <Error>: CgBI: unknown critical chun
4/14/09 8:56:53 PM com.apple.quicklook[326] Tue Apr 14 20:56:53 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[326] <Error>: CgBI: unknown critical chun
4/14/09 8:56:53 PM com.apple.quicklook[326] Tue Apr 14 20:56:53 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[326] <Error>: CgBI: unknown critical chun
4/14/09 9:17:58 PM com.apple.quicklook[516] Tue Apr 14 21:17:58 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[516] <Error>: CgBI: unknown critical chun
4/14/09 9:17:58 PM com.apple.quicklook[516] Tue Apr 14 21:17:58 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[516] <Error>: CgBI: unknown critical chun
4/14/09 6:42:51 PM com.apple.quicklook[47269] Tue Apr 14 18:42:51 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[47269] <Error>: CgBI: unknown critical chun
4/14/09 6:42:51 PM com.apple.quicklook[47269] Tue Apr 14 18:42:51 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[47269] <Error>: CgBI: unknown critical chun
4/14/09 8:56:53 PM com.apple.quicklook[326] Tue Apr 14 20:56:53 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[326] <Error>: CgBI: unknown critical chun
4/14/09 8:56:53 PM com.apple.quicklook[326] Tue Apr 14 20:56:53 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[326] <Error>: CgBI: unknown critical chun
4/14/09 9:17:58 PM com.apple.quicklook[516] Tue Apr 14 21:17:58 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[516] <Error>: CgBI: unknown critical chun
4/14/09 9:17:58 PM com.apple.quicklook[516] Tue Apr 14 21:17:58 c-98-203-115-95.hsd1.fl.comcast.net quicklookd[516] <Error>: CgBI: unknown critical chun
MacBook Pro, Mac OS X (10.5.6)
  • Planet9 Dave Calculating status...
    Greetings,
    I found your question while also searching for an answer. While I haven't found one yet, I can at least clarify your issue. I'm debugging my own iPhone app, and this error is coming out of the PNG image-file reader. I've determined (so far) that the PNG image in question loads fine under Windows XP, and in the iPhone simulator, just not on the device. Looking at the libpng source code (freely downloadable: http://libpng.org/pub/png/libpng.html), it is clear that all chunks have four-letter names, and must always start with a lower-case letter (*). While the version of the source I'm working from doesn't support one, it -looks- like this might be an "endian" problem (successive pairs, or quads, of bytes are reversed on one type of processor as compared to another) for a chunk named "gCIB". Or it might indicate that the previous chunk in the image file was read incorrectly (though consistently so) and this is some "other data" that the reader is trying to interpret as the name of the next chunk. I'll try to remember to come back and follow up on this should I be able to solve my own problem!

    (*) Technical note: The checks in the libpng code actually verify that the first character has bit 5 (of 7..0) set:
    if (!(pngptr->chunkname[0] & 0x20)) {
    ...
    pngchunk_error(pngptr, "unknown critical chunk");
    so any ASCII characters in the (decimal) ranges 32-63 (which includes the numeric digits) or 96-127 (which includes the lower-case letters), or even non-ascii 8-bit characters in the ranges 160-191 or 224-255, should work also. At least as far as the above test is concerned.
    iPhone, Mac OS X (10.5)
  • Planet9 Dave Level 1 Level 1 (0 points)
    Well, that was fast. Next time I'll read first and post later! Anyway, there's a great discussion of this issue at http://www.nabble.com/CgBI-error-td19563316.html, but in a nutshell:

    The chunk name -is- in fact CgBI -- the 'C' indicates that the chunk is critical and cannot be ignored, the 'g' indicates that the chunk type is private and that a file containing it is not portable (and thus is a bad idea to publish as a valid PNG file), and the presence of the chunk in the file (an Apple-specific variant) indicates that the pixel data is stored as 'BGRA' rather than the usual 'RGBA' color order.

    Now what is not at all clear to me, at this juncture, is (a) why on earth Apple would need or want to reverse the stored byte-order of pixels in a PNG file in the first place, and (b) why my copy of the libpng source handles a private chunk-type on Windows and on the iPhone simulator, but not on the device. Or is it that the pixel data is actually correctly ordered, and libpng is ignoring the unrecognized chunk on Windows and iPhone simulator, but not on the device?

    Arrrrrgghhhh!!!

    Anyway, the "solution" seems to be to load the image in an app that handles the CgBI chunk and save it back out as some other type (while preserving an alpha channel if it has one), then use some non-Apple application to convert the image back to PNG (if you need to use PNG) so that the resulting file won't have the Apple-specific chunk in it.

    Good luck.

    Dave
    iPhone, Mac OS X (10.5)
  • Planet9 Dave Level 1 Level 1 (0 points)
    Yeesh, finally found it in another discussion thread in the Apple forums here (http://discussions.apple.com/message.jspa?messageID=8314150) which references an external webpage full of all kinds of useful iPhone trivia (though could stand a hyperlinked table-of-contents at this point, hint hint -- http://plaidworld.com/iphonefaq.txt). Sorry for all the incoherent and often incorrect material I posted earlier.

    What's going on is that the pixel ordering in PNG image-format files is converted from RGBA to BGRA, and the color values are pre-multiplied by the alpha channel value as well, by a compression utility 'pngcrush' (for device-specific efficiency reasons, when programming with the UIKit interface). The utility also (apparently) renames the required IHDR header chunk to CgBI, making the new PNG file unusable anywhere else (*). These are done AUTOMATICALLY when PNG files are deployed onto the iPhone. While this is fine for the UIKit, libpng (and other non-Apple libraries) generally can't then read the files.

    This explains my earlier confusion about why the PNGs work in other situations: the original PNG is fine, it's what Xcode does to it while putting it onto the iPhone that causes the problem I have on the device.

    The simple solutions are:
    1) rename your PNG files, if you have control over how they're loaded later, with a different extension, such as .ppng
    2) for your iPhone -device- build (double-click on the appropriate target, make sure the Configuration is selected appropriateley at the top of the 'Build' pane), add the following user-defined setting (click the 'gear' icon at the lower-left of the info window, select 'Add User-Defined Setting'):
    ...
    User-Defined:
    IPHONEOPTIMIZEOPTIONS | -skip-PNGs

    At this point, I have no idea whether I've addressed the original question, but hope that anyone searching for a solution has been helped!

    (*) Of course, if you have the source code, e.g. for libpng, you could code your way back out (accept CgBI in place of IHDR, divide RGB values by A, and handle the BGR ordering). Good luck, have fun, code safely!

    Dave
    iPhone, Mac OS X (10.5)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.