ImageNew Tobase64 encoding problem, ColdFusion quality decline

I have been experiencing problems with toBase64(). I hope someone can tell me why CF toBase64() seems to be missing something, for example in my case it reduces the quality of the image .

I have a solution (see the last code example below), but I don’t want to understand why and am willing to solve this problem.

If anyone would be so good at running The code below, then you will see that the image quality is poor after toBase64 conversion. It’s no big deal, but it doesn’t look good after encoding. If you never noticed, then try it and you will understand what I mean .

Does anyone know why, or how to solve this problem in CF?




< cfset image = ImageNew("test.png")>







My solution is to use java add-ons , Everything seems to be okay, but for reasons I will not enter here, not something I can do.

image = createObject("java","it.sauronsoftware .base64.Base64").encode(image);
toBinary(image );

Sample image output of the above code can be found here: http://i56.tinypic.com/29fwiq .png
First after toBase64 seconds, you can see that the image loses a bit of quality after the toBase64 function on the second output.

Update: As Peter pointed out, the problem seems to be Automatic output/conversion code in ImageObject to provide binary output for toBase64 function for encoding.

Update I have submitted this as a bug in CF 9.0.1, please vote for bug 3177303
https ://bugbase.adobe.com/index.cfm?event=bug&id=3177303

use toBase64 (imageGetBlob(myImg))

See: http://blog.dkferguson.com/index.cfm/2010/4/27/All-your-base64-are-not-equal< /p>

I have been experiencing problems with toBase64(). I hope someone can tell me why CF toBase64() seems to be missing something, for example in my case it lowered The quality of the image.

I have a solution (see the last code example below), but I don’t want to understand why and am willing to solve this problem.

If anyone will So good at running the code below, then you will see that the image quality is poor after toBase64 conversion. It’s not a big deal, but it doesn’t look good after encoding. If you never noticed, then try it and you will understand I mean.

Does anyone know why, or how to solve this problem in CF?




< cfset image = ImageNew("test.png")>







My solution is to use java add-ons , Everything seems to be okay, but for reasons I will not enter here, not something I can do.

image = createObject("java","it.sauronsoftware .base64.Base64").encode(image);
toBinary(image );

Sample image output of the above code can be found here: http://i56.tinypic.com/29fwiq .png
First after toBase64 seconds, you can see that the image loses a bit of quality after the toBase64 function on the second output.

Update: As Peter pointed out, the problem seems to be Automatic output/conversion code in ImageObject to provide binary output for toBase64 function for encoding.

Update I have submitted this as a bug in CF 9.0.1, please vote for bug 3177303
https://bugbas e.adobe.com/index.cfm?event=bug&id=3177303

Use toBase64(imageGetBlob(myImg))

See: http://blog.dkferguson.com/index.cfm/2010/4/27/All-your-base64-are-not-equal

Leave a Comment

Your email address will not be published.