Hi,
I want to convert image object url image to binary, but unable to do so, as further i have to conver it to base64.
I am not getting help from anywhere, i tried alot, thanks in advance.
i m trying like this
var buffer_data = imageObject.toArrayBuffer();
but when i convert it into base64 it do not convert properly
with the fnc below. but if any string i want to convert, it converts properly
function arrayBufferToBase64( buffer ) {
var binary = '';
var bytes = new Uint8Array( buffer );
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return Qt.btoa( binary );
}
Please help. i am stuck in it from last 3weeks
Solved! Go to Solution.
HI
please have the solution of my problem
var s =imageObject.toArrayBuffer('jpeg') ;
var b = AppFramework.binaryData(s); // produces a binary data object
console.log(b.base64);
imageObject.loadFromData(b.base64);
Hi @rsharma ,
Is there any ArcGIS Runtime workflow you're trying to achieve with this? If not it's a bit off topic and more related to QML general programming.
Generally speaking, whenever we've had to do image processing we use the QQuickImageProvider pattern, which does require a bit of C++ logic. I don't know if this directly applies to your use case, but I hope it is helpful.
HI
please have the solution of my problem
var s =imageObject.toArrayBuffer('jpeg') ;
var b = AppFramework.binaryData(s); // produces a binary data object
console.log(b.base64);
imageObject.loadFromData(b.base64);