Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing preloaded canvas #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

manuelnaranjo
Copy link

Adding an extra option canvasimg that lets the user of the library pass a canvas with the image preloaded, this allows for instance to get a rotated picture from a cellphone and display it correctly based on the EXIF header.

A little context, this cordova plugin uses base64 encoded images instead of files, on a Samsung A5 2017 (8 cores, 3GB RAM) rotating a 16MP images takes something like 5 seconds because and all of this time is been spent on generating the base64 string after rotation. I have a change I'm gonna submit to them which is instead of stripping off the rotation exif header and rotate on Java, just add the header and let the browser rotate, as it can use the GPU

With the change to your package I can get a rotated image which I can zoom-in in near realtime.

Adding an extra option canvasimg that lets the user of the library
pass a canvas with the image preloaded, this allows for instance
to get a rotated picture from a cellphone and display it correctly
based on the EXIF header
The caching feature is super nice, but it's actually risky. If you
start creating big enough objects at a high frequency (less than 1
minute) then the cache starts growing and growing which leads to
a memory leak. This is more notoriuous on mobile devices, and
specially when the module is used to display 16MP images.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant