How do I create a CF compatible image object from a java Buffered Image without the use of CF ImageNew() function?
imageCFCObj = createObject("component","imagecfc.image" );
local.img1 = imageCFCObj.readImage("D:\#arguments.directoryPath#");
// local.img1 now of type java.awt.image.BufferedImage
// from here how do you create a CF compatible image object?
(Updated to include links) So without using CF function ImageNew() (it has major issue with automatic output/conversion code, see bug #3177303 ) How do you change this using JAVA in CF to a compatible CF image object I can use.
(From the comments above, the answer ended up going in a different direction).
As mentioned in this thread using toBase64(imageObject)
and imageGetBlob
may result in degradation of image quality because png
images are converted to jpg
format. These functions seems to determine the return format incorrectly.
A possible work-around is using the undocumented Image.getImageBytes(format)
method which allows you to specify the output format explicitly.
<cfset bytes = yourCFImageObject.getImageBytes("png")>