Get pixel data from image under canvas element?

Using getImageData (), you can display pixel color data on the canvas image. If I overlay a transparent canvas element on a background image or flash movie, can I select a color from it using the canvas tag?

+3
source share
2 answers

Phil is right, you can't do this. By design, Canvas returns only its own internal pixel data, and not any content displayed on the screen that comes from other elements.

You can create a canvas element that spans the entire page and captures the image of the displayed screen.

, . iframe ( cookie // ), .

+5

, . . document.defaultview.getComputedStyle(element,pseudoElt), div "".

, , . ? , .

" javascript. , . , , - ".

, , -, : . , .

+2

Source: https://habr.com/ru/post/1705324/


All Articles