views:

42

answers:

1

One Google Chrome extension displays a window with an image once in a while, how can I get the image from it with Cocoa?

Basically there is a window and image inside it, and I need that image for my program.

Thanks for reading!

+2  A: 

Use CGWindowList to get all the windows in the current session, look through it for the one you're interested in, use CGWindowList again to take a screenshot of it, and cut the image out of the screenshot.

If the window is sized and/or scrolled such that the image is not completely visible, you're out of luck.

There is no way to extract the original image from a window it might have been drawn into.

Peter Hosey