3 ms·
3 sounds incredibly undesirable to me, assuming we’re dealing with a jpeg. Go through 3 or 4 rounds of that and compression starts to get pretty visible.
by TylerE 4y ago
3 sounds incredibly undesirable to me, assuming we’re dealing with a jpeg. Go through 3 or 4 rounds of that and compression starts to get pretty visible.
- kevincox 4y agoMost websites will recompress user images. Although you probably don't want to do it client side. The biggest reason is if course cost saving. Store and transfer smaller images. This could be done client side with a server side check on max size. Another big reason is metadata stripping. Both to protect the user (can be done client side) and to avoid unintentional data channels being provided. Another reason is to avoid triggering exploits. If a major browser has a JPEG rendering exploit Facebook doesn't want you to be able to pwn everyone who sees your post. By using a trusted encoded it is very likely that the produced image is more or less following the standards and not likely to trigger any exploits (as exploits usually require invalid files).
- alexriddle 4y agoI'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.
- ambicapter 4y agoI 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?
- bdhcuidbebe 4y ago> a base64 string representing a compressed image Parent explained that the base64 encoding held compressed data.
- TylerE 4y agoBut why base64 and not just… send the bytes? 6 bits per character vs 8