Q:

Is there any method to shorten image data URI using javascript/jquery?

I have converted a canvas image to data URI using jquery and the data URI is too long, say about  800,000 characters. 
Is there any methods for reducing/shortening the length of the data URI?
I need to send the image data via GET/POST method but I got an error message that the string length is too long 

A:

canvas.toDataURL() support different image types. You could try the different formats or use jpg and decrease the quality:
e.g. for 100% quality:
canvas.toDataURL("image/jpeg", 1.0)

or for 50%:
canvas.toDataURL("image/jpeg", 0.5)

This should reduce the image size and therefore the amount of image data.

A:

You cant.As this is the canvasimagedata(which is a base64 string).If you reduce it,some of the data maybe lost.Base64 itself is fairly compressed.You can check out JavaScript implementation of Gzip 
You can try adjusting the image quality i.e (image/jpeg,value from 0-1)
But this wont reduce it to a great extent.

