Hacker News new | ask | show | jobs
by alexriddle 1191 days ago
I've had to implement this - we have a web app used by engineers in the field where signal is often not great. We got lots of complaints about image uploads as for a typical job there would be potentially 100+ images that needed to be uploaded (multiple assets with 2 before and 2 after photos per asset).

iPhone defaults to uploading a large image which can take ages to upload. We implemented a canvas based solution which sends a base64 string representing a compressed image and reduced the upload file size by about 90%. We don't need high quality original images in the backend.

I may have missed a trick, this has been in place for a few years now but at the time I couldn't find a better solution.

1 comments

I was under the impression that base64 encoding doesn't reduce file size of an image at all, rather it sometimes increases it. That wasn't the point of using base64 string, right?
> a base64 string representing a compressed image

Parent explained that the base64 encoding held compressed data.

But why base64 and not just… send the bytes? 6 bits per character vs 8