Renattele Renattele
Renattele Renattele

Reputation: 2286

How to analyze image in gjs/gnome-extensions?

How I can get pixel of image in gjs/gnome-extensions? I tried Image() but it undefined in system.

Upvotes: 0

Views: 111

Answers (1)

ptomato
ptomato

Reputation: 57920

You should use GdkPixbuf.Pixbuf for this. The get_pixels() method will return a Uint8Array with the image data, and you can index an individual pixel with pixels[y * pixbuf.rowstride + x * pixbuf.nChannels].

(Image is part of the HTML DOM. GNOME extensions don't run in a browser environment, so there's no DOM, just the same as in Node.js.)

Upvotes: 1

Related Questions