-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Don't use mozGetAsFile when quality is passed #13
Comments
The performance benefits greatly outweigh the slight performance increase of using quality+toDataURI as the base64 encoding overhead is still much much greater. Unfortunately no matter what (reasonably high enough) quality is selected in toDataURI, it will always be slower than mozGetAsFile. Do you have any significant non-performance reasons to use quality+toDataURI? |
Performance? Stripping the quality gives you the wrong file. The point of quality is to affect the image quality / filesize of the file. If you strip it out then you're not giving the file that toBlob is expected to give out. Local performance is irrelevant if you upload the wrong quality blob to the server. It's pretty irrelevant anyways since Firefox has native toBlob now. The only people using mozGetAsFile are using outdated Firefox. Trying to optimize performance for them at the cost of getting the correct output is pointless. |
The whole point of using toBlob instead of toDataURL is performance, and it's not like I added the moz method to support old Firefoxes--it was added back when it was the only performant method in any Firefox. You are still getting the correct image format, just not at the desired quality. I understand your concern though and I will accept a patch that uses toDataURL instead of the moz method when the format is image/jpeg and a non-1 quality is specified. |
To me the whole point of using toBlob instead of toDataURL is getting a format that XHR2 will accept and upload with In any case thanks for responding. I don't need the IE9- base64 support or toBlobHD so I just went with using canvas-to-blob for my project. |
mozGetAsFile
doesn't accept a quality argument liketoDataURI
as a result the quality argument on toBlob won't have an effect on jpeg and webp images.The text was updated successfully, but these errors were encountered: