I have a set of test cases that pass just fine loading a known CMYK jpeg via ImageNew(). Later, with no restart of the app server, these same test cases fail. Again, after a while, the test case passes again. I've dug into the Java a little bit, and I wonder if the ImageReader implementation being used doesn't switch out once in a while -- like maybe a hashtable of ImageReaders reorders or something.
I know the CMYK is only partially supported, but I could get data with ImageNew and ImageInfo showing it was a CMYK file, then later on, it would throw "Image Not Supported" errors.
Anybody have knowledge of these inner workings to provide some insight? Smells a bit like a bug to me, but I can't consistently replicate it.
From what I can tell, it does appear to be a bug. I have submitted a bug report to Adobe on it.
What seems to be occurring is that coldfusion.image.ImageReader is trying to find the CLibJPEGImageReader class from the collection returned by javax.imageio.ImageIO.getImageReadersByFormatName("jpeg"). This works fine if it is the first object returned in the collection, but if not, it will return another JPEG ImageReader that does not support CMYK images. I have two systems (both RedHat) which are currently in each state. One has the CLibJPEGImageReader as the first element in the ImageReader collection, and in the other, it is the second element in the collection. The code below will work fine when the correct reader is found, but not when it isn't the first element in the collection.