Home > Software design >  How to analyze image in gjs/gnome-extensions?
How to analyze image in gjs/gnome-extensions?

Time:01-04

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

CodePudding user response:

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.)

  •  Tags:  
  • Related