Reputation: 1004
I need to get the color value for each pixel in svg rect element.In canvas we can get it through the method getImageData(x,y,width,height).
In svg,is there any way to do it??If so please give some working examples.
Upvotes: 2
Views: 2856
Reputation: 124249
If you create a standalone SVG file and include that in your document via an image element e.g. a html <img>
element then you can copy the image data into canvas via drawImage and you already know how to extract colour values from canvas.
This indirect route is the only way.
Upvotes: 2