3 ms·
I was really hoping this would implement some complex algorithm or at least be an interesting implementation, however, it seems to just divide the image height/
by MaxLeiter 9y ago
I was really hoping this would implement some complex algorithm or at least be an interesting implementation, however, it seems to just divide the image height/width by the aspect ratio:
https://github.com/xkeshi/image-compressor/blob/master/src/index.js#L80-L87 https://github.com/xkeshi/image-compressor/blob/master/src/i...
- phoboslab 9y agoAs I understand it, this library draws the image into a Canvas to then re-compress the Canvas' via the Browser's native `toDataURL('image/jpeg', quality);`. You can optionally specify a width/height to downscale the image. Imho the readme needs to state what the library actually does. E.g. "This takes a user image from a file input, optionally resizes it, and returns a JPEG, PNG or WebP as a Blob, ready to upload."
- octalmage 9y agoAgreed! I haven't looked into this at all but I wonder if you can run some algorithm on the datauri.