Skip to content

toDataURL callback for jpeg #4667

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

Closed
wants to merge 2 commits into from

Conversation

nobuttsseb
Copy link

Problem: in nodejs there was no way to get jpeg data back from canvas as fabric did not provide a way to pass through a callback.

Solution: just added in a callback argument in the functions from fabric.toDataURL to canvas.toDataURL

nodejs: provide callback from fabric.toDataURL to canvas.toDataURL when format is jpeg
@asturur
Copy link
Member

asturur commented Feb 2, 2018

JPEG todataurl is async on nodecanvas?

@nobuttsseb
Copy link
Author

nobuttsseb commented Feb 2, 2018

Yup, it is async. In canvas there is a jpeg stream where the callback with the base64 data triggers when the stream ends.

@asturur
Copy link
Member

asturur commented Feb 2, 2018

how jsdom solves this? any idea?

@nobuttsseb
Copy link
Author

No idea, sorry.

@nobuttsseb
Copy link
Author

The same code diff needs to apply to 1.x branch. I'm just updating my fork.

@brandondong
Copy link
Contributor

Hi, I'm running into this issue as well. What's the status of this PR? Are there any known workarounds for this? It looks like node-canvas recently merged a fix: Automattic/node-canvas#1194.

@asturur
Copy link
Member

asturur commented Aug 3, 2018

So if we could backport the nodecanvas fix in the 1.x branch that would be awesome, otherway we need to update to nodecanvas 2, and fork jsdom 9.x in order to support nodecanvas 2 or fork jsdom latest in order to support nodecanvas 2 and also drop support for node 4 and so bump fabric version to 3.0

@asturur
Copy link
Member

asturur commented Jun 1, 2019

this has been fixed with nodecanvas 2

@asturur asturur closed this Jun 1, 2019
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.

3 participants