I am uploading images as base64 strings to an ASP.NET WebService via AJAX. Because of AJAX/JSON, the maximum filesize is pretty limited (from my tests around 3MB before the AJAX requests get too long).
So is there any way, to resize a given image to a FIXED file size (like 3MB) and not a fixed resolution?
I already now about the capabilities of canvas
for resizing purposes, but setting the resolution and/or quality isn't just cutting it for me.
An idea I already had, was to have a loop resize the image over a couple of cycles and check the approximate filesize by checking the base64 length, but that seems both not efficient and not precise enough.
I know I could chunk the requests, but I would have to change the WebService as well, which I only want to do as a last resort.