-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use standard Canvas ctx.filter
API (blur/grayscale/saturate/contrast)
#1063
Comments
This api is actually much new also for browsers ( chrome 49+ ) |
Ah, right. Closing issue for now. |
I did not mean to make you close it. Just can be expected that is not implemented in node-canvas since it became a standard non experimental api not long ago. |
No, no - I previously thought that this is a bug, but actually it is a feature request. Hence closed it. 😄 |
Feature requests are valid issues :-) |
filter
API mismatchctx.filter
API (blur/grayscale/saturate/contrast)
ctx.filter
API (blur/grayscale/saturate/contrast)ctx.filter
API (blur/grayscale/saturate/contrast)
i would like to work on this, i wonder if we have the exact specs of the filters. Would be ok to implement those with normal loops over the pixels? |
Reopening because we still don't have this feature. @asturur I think the full list is here: https://drafts.fxtf.org/filter-effects/#supported-filter-functions.
It's better to use Cairo APIs if possible because Cairo and pixman use SIMD extensions. However, the Cairo cookbook recipe for Gaussian blur (https://www.cairographics.org/cookbook/blur.c/) is indeed a loop. (Skia on the other hand has quite a few filters built in, were we to switch to that.) |
Oh ok, I was going through all my open issues across GitHub and closing old ones. Thanks for reopening. |
I have a dumb question, since so long and i never made it just because i was worried it was too dumb. To get a great node-canvas compatibility, what does stop someone to take the full firefox canvas implementation from the source code and make it for node? Wouldn't it an accurate node-canvas at that point? |
Hm, I found this: https://github.com/Automattic/node-canvas/blob/master/src/CanvasRenderingContext2d.cc#L615 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
In the meantime I will use skia-canvas which supports filters, it's a great alternative. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
To support filters we will need to migrate to Skia graphics engine from the Cairo engine. Such a rewrite would effectively be like starting an entirely new project and should not be in the scope of this project (which should continue to be a great canvas API wrapper on top of Cairo engine) - hence closing this. See discussion here: #1652 (comment) |
Another option is to implement filters "the old way" (i.e. write the filters in JS and composite to a new, same-sized pixel matrix, then replace the original with the updated one) and tell folks that while things will technically work, it will be slow. For most applications that would probably be an acceptable tradeoff: I'd much rather wait a little longer for image generation to finish if it means the result looks (near) identical between node-canvas and the browser =) |
HTML5 Canvas recently introduced support for filters like
ctx.filter = "blur(5px)";
in the browser, for example toblur
,saturate
,grayscale
and modifycontrast
.Issue or Feature
API support for HTML5 Canvas
ctx.filter
from from MDN web docsSteps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: