Mike Chaney's Tech Corner

Mike's Software => Qimage Ultimate => Topic started by: admin on September 15, 2011, 01:17:45 PM



Title: Qimage exposes PhotoShop CS5 (12.0.4) JPEG corruption bug
Post by: admin on September 15, 2011, 01:17:45 PM
Just wanted my users to be aware of a situation where an intermittent PhotoShop CS5 bug causes CS5 (12.0.4 version) to save JPEG images with a corrupted file header and the effect that might have on various imaging programs you might use.  The problem, which is intermittent but not infrequent, usually occurs when using the "Image Processor" script or when simply saving a JPEG file from CS5 12.0.4.  The CS5 issue has been reported most often when opening/processing raw photos to save in JPEG format.  Here's a description of the problem.

Technical Details:
The CS5 JPEG file saving bug was first reported by Qimage users who noticed that they could run the CS5 image processor on a batch of raw photos and end up with a directory of JPEG's, some of which incorrectly showed sRGB as the color space.  Obviously this could result in incorrect color (on screen or in prints).  The reason for the mis-read color space is due to CS5 corrupting the header on (some) JPEG saves, placing extra (and erroneous) ICC profiles or "color spaces" into thumbnails inside the JPEG.  Interestingly, when this occurs, you can run the exact same image processor conversion immediately a second time and different JPEG's from the same batch of raws would be corrupted.  This is the intermittent nature of the CS5 JPEG file writing bug: whether or not the JPEG header gets corrupted depends on which images were processed previously and what order they were processed which makes this look like the typical "variable initialization" type bug.

If the problematic files (showing sRGB in Qimage, not loading at all or loading slowly in BreezeBrowser) are examined, the file header is found to not conform to JPEG standards.  The files contain multiple "APP2" ICC profile tags, one of which is embedded inside the thumbnail in the JPEG: where the JPEG spec specifically states it does not belong.  In fact, the embedded thumbnails are supposed to be simple image streams with no embedded JFIF tags (like the ICC profile tag) at all!  The mal-forrmed header causes some programs (the old Qimage's, Qimage Ultimate prior to v2012.104, BreezeBrowser, some mail programs, etc.) to produce unexpected results due to the extra (errant) embedded profile(s).

Symptoms:
  • Qimage (Lite/Pro/Studio) and Qimage Ultimate v2012.103 and older: After processing images in CS5 12.0.4 (the latest version as of this writing), some JPEG's may incorrectly show sRGB as the embedded color space in Qimage when in fact, the correct color space is Adobe RGB.  Qimage Ultimate has updated error correction that solves this issue in v2012.104 and later versions.
  • BreezeBrowser: Corrupted JPEG's may take a very long time to load or BB may crash.
  • Image cataloging/database programs and file archive/backup programs: Since, depending on your workflow, you may process some raw photos multiple times, it is not possible to tell when your converted JPEG's have actually changed.  Since CS5 cannot reliably save the same JPEG file the same way twice, files that differ in size may just differ due to the bug, so file cataloging/backup programs may report that certain JPEG's have been updated when in fact, you've made no changes.
  • Other programs: Some have reported certain mail programs/servers rejecting the corrupted images as invalid images.
 
Fix:
Qimage Ultimate v2012.104 has been updated with better error checking that can detect and fix the problem.  I do not plan to update the retired versions (Lite/Pro/Studio) since they are not under active development and this is essentially a workaround for an Adobe bug.  I've contacted Adobe and after 10 days of refusing to follow examples and instructions sent by myself and several others, they continue to modify and delete responses on their forum in an attempt to shift blame to Qimage (and BreezeBrowser and other programs) for not "properly handling" the Adobe file corruption.  Bottom line: while Adobe still denies that the extraneous ICC profile tags constitute corruption, they are aware that they have a (what they term "minor") bug and they plan to fix it.  How long that will take is anyone's guess.  Unfortunately if you use BreezeBrowser or another program that also has problems reading the corrupted header in the CS5 JPEG's, the problem is intermittent so it is difficult to predict the outcome when saving JPEG's from CS5's latest 12.0.4 update.  My suggestion is to save in TIFF format to avoid this issue if/until Adobe fixes CS5 since I've tested the file saving and the TIFF format does not seem to suffer from the same issue.

Mike