Dirk
05/11/2022, 12:33 PMwil-shiftinsert
05/11/2022, 12:38 PMwebsolete
05/11/2022, 12:43 PMbinaryEncode( imageObj, "base64" )
Dirk
05/11/2022, 12:47 PMDirk
05/11/2022, 12:48 PMwil-shiftinsert
05/11/2022, 12:49 PMDirk
05/11/2022, 12:51 PMwebsolete
05/11/2022, 1:02 PMDirk
05/11/2022, 1:03 PMwebsolete
05/11/2022, 1:03 PMbinaryEncode( toBinary(imageObj), "base64" )
Dirk
05/11/2022, 1:04 PMtoBinary()
results in an exceptionwebsolete
05/11/2022, 1:06 PMwebsolete
05/11/2022, 1:06 PMDirk
05/11/2022, 1:07 PMDirk
05/11/2022, 1:10 PMDirk
05/11/2022, 1:21 PMmyCfImage = ImageNew(...);
imageFilePath = 'ram://' & createUUID() & '.png';
myCfImage.write( imageFilePath );
myCfImage = fileReadBinary( imageFilePath );
fileDelete( imageFilePath );
myCfImageBase64 = toBase64( myCfImage );
Mark Takata (Adobe)
05/11/2022, 4:21 PMDavid Buck
05/12/2022, 8:20 PMImageNew()
is that it doesn't set a file type when you create an image from scratch. There is a Java method, getImageBytes()
, that appears to remedy this by allowing you to specify the file type:
myImage = ImageNew("",500,500,"argb","white").getImageBytes("png");
However, that turns your image object into a binary, so you'll need to send it back to ImageNew to turn it back into an image object:
myImage = ImageNew(ImageNew("",500,500,"argb","white").getImageBytes("png"));
Now you should be able to base64 encode it, or do anything else you could do if you had started with a source file.
That said, if base64 encoding is all you need, there is a shortcut:
ImageNew("",500,500,"argb","white").getBase64String("png")
priyank_adobe
05/12/2022, 8:43 PMDirk
06/07/2022, 10:38 AMDirk
06/07/2022, 10:41 AM