jpeg-autorotate icon indicating copy to clipboard operation
jpeg-autorotate copied to clipboard

Does it work in the browser?

Open selbekk opened this issue 6 years ago • 4 comments

I couldn't find a reference to it in the readme - does this lib work in the browser?

selbekk avatar Apr 25 '18 20:04 selbekk

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)

johansatge avatar Apr 25 '18 20:04 johansatge

Thanks for the quick reply! Ah shucks - that's too bad.

selbekk avatar Apr 25 '18 20:04 selbekk

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
  • [ ] 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 👍

johansatge avatar Apr 25 '18 20:04 johansatge

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

xaphod avatar Nov 11 '20 14:11 xaphod