A few weeks ago, I wrote about the lousy error message handling in GDI+. Apparently, it is not only just lousy, but incomplete as well.

Earlier today at work, I was converting a few TIFF images using a tool I developed a couple of months ago. I encountered "Out of Memory" errors on a few of those images and given my experience before, I had assumed that those images were corrupted (e.g. the header information is invalid). This became somewhat more evident when I tried to open them using the Windows default image viewer (Windows Picture and Fax Viewer), which complained that the image could not be opened.

So at first, I thought that the images were corrupted indeed. But after talking with the engineer who gathered the image, I found out that there was nothing wrong with those images as the same "unreadable" images can be opened by a lot of third party tools. As it turned out, those "unreadable" images are JPEG compressed TIFF images.

After some research, I came to the conclusion that GDI+ in Windows (XP and Server 2003) simply could not handle this type of TIFF file. When opened the returning message is the same as if the file header was not recognized. While I did not find any official article from Microsoft that states such a problem, the following knowledge base article pretty much admitted it.

The workaround mentioned in the knowledge base article however, does not work for me as in my particular situation, the reading of the images need to be autonomous.

As a fast work around due to the time constraint, I used a free command line utility to convert the JPEG compressed TIFF into non-compressed TIFF and sure enough, the formerly unreadable images were read successfully.

Be Sociable, Share!