Copy link to clipboard
Copied
I've run into a puzzle using cfimage trying to manipulate .JPG images. Certain files work on Machine A but not Machine B. (Exception being "Unsupported Image Type".)
GetReadableImageFormats() returns 15 formats on Machine A, only 12 on Machine B. The missing filetypes are:
Both machines are running CF9 Standard. Machine A is 32-bit, Machine B is 64-bit.
I guess I'm wondering if something can be tweaked on Machine B to enable support for these file types. Any ideas?
Copy link to clipboard
Copied
Well I'm still curious about the supported image types, but I was able to run around the issue using Java. It reads the image CF didn't like and converts it from CMYK to RGB before creating a CF image object.
<cfscript>
/* init JAI, read file */
JAI = createObject("Java","javax.media.jai.JAI");
img = JAI.create("fileload","#this.filepath#\uploads\#local.filename#");
/* init colorspace to convert to RGB */
model = img.getColorModel();
space = model.getColorSpace();
rCS = createObject("java","java.awt.color.ColorSpace").CS_sRGB;
rgb = createObject("java","java.awt.color.ColorSpace").getInstance(rCS);
convert = createObject("java","java.awt.image.ColorConvertOp").init(rgb,javaCast("null",""));
//convert JAI to normal Java buffered img
bImg = img.getAsBufferedImage();
rgbImg = convert.filter(bImg,javaCast("null",""));
/* back to CF */
newImg = ImageNew(rgbImg);
// strangely, JAI seems to have created a negative image
imageNegative(newImg);
</cfscript>
Copy link to clipboard
Copied
I would presume it's the JVM rev level that dictates this. Are they different on each server? I presume a given rev level of JVM is functionally equivalent irrespective of being 32- and 64-bit implementations?
--
Adam