jpeg-autorotate
jpeg-autorotate copied to clipboard
Does it work in the browser?
I couldn't find a reference to it in the readme - does this lib work in the browser?
Hi,
currently it does not unfortunately (it uses the jpeg-js module which is for nodejs only, I think)
(I'll clarify it in the readme, thanks for the feedback)
Thanks for the quick reply! Ah shucks - that's too bad.
That would be great though!
Roughly, here is what would be needed to make it work:
- [ ] Make sure
piexifjs
works in the browser - [ ] Make
jpeg-js
work in the browser (looks like there is an existing PR) - [ ] Make the
jpeg-autorotate
module compatible with both browser & node- [ ] Handle
module.exports
vs browser definition - [ ] Expose the source in a single file that can be embedded with
jsDelivr
or similar
- [ ] Handle
- [ ] Define how to give an image to the module when running in the browser (Blob,
img
tag from the DOM...) and implement it - [ ] Update the unit tests accordingly
Let's keep the issue opened. I'll try to dig if I find some time.
Of course, if someone reads this issue and is interested in working on the subject, pull requests are very welcome 👍
IMO if you want to do it in the browser, consider a canvas-based approach. Here's one that looks decent: https://github.com/ajgarn/CanvasImageUploader