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

Cloning ImageData #610

Closed
inssein opened this issue Aug 22, 2015 · 5 comments
Closed

Cloning ImageData #610

inssein opened this issue Aug 22, 2015 · 5 comments

Comments

@inssein
Copy link
Contributor

inssein commented Aug 22, 2015

I can't figure out how to clone an ImageData object, short of retrieving it again from the context.

All the methods I know of require ImageData.data to be a Uint8ClampedArray with the setter exposed. Is there anything I can do right now, short of waiting for #604 to be merged?

@LinusU
Copy link
Collaborator

LinusU commented Aug 22, 2015

There is putImageData, or am I misunderstanding what it is you want to do?

@inssein
Copy link
Contributor Author

inssein commented Aug 22, 2015

@LinusU I wanted to clone ImageData, and then perform some operations.

Example: https://github.com/inssein/jsfx/blob/master/src/filter/unsharpMask.ts#L75

@LinusU
Copy link
Collaborator

LinusU commented Aug 22, 2015

Shouldn't that code work as is right now?

@inssein
Copy link
Contributor Author

inssein commented Aug 22, 2015

@LinusU works on the web, doesn't seem to properly clone in node-canvas. Also, shouldn't it be a CanvasPixelArray right now, before the PR is merged?

@inssein
Copy link
Contributor Author

inssein commented Aug 23, 2015

Sorry, the issue was with something else. new Uint8ClampedArray(imageData.data) seems to clone the data just fine.

@inssein inssein closed this as completed Aug 23, 2015
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

No branches or pull requests

2 participants