Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp 3: get indexed of each pixel from a layer = img.layers[0] pdb.gimp_layer
#6
Hi TheInstinct,

In setting the format name to "R~G~B~ u8" you are asking for it to store the data in that format.
Set the format name to None and the format of the buffer will be used.
So change to:
data = buffer.get(rect, 1.0, None, Gegl.AbyssPolicy.NONE)

I have just tested this on an indexed image with a 6x6 layer and I am getting the color indexes.

Printing the data, your format name gave:
b'\xec\x00\x00H\xa6\xf00\x84\\\xdc\x1d\xda\xf0\xe8H\xc4DH'
With format name None on the same layer I got:
b'\x00\x04\x03\x01\x05\x02'
and the colour indexes match the palette I used.
Reply


Messages In This Thread
RE: Gimp 3: get indexed of each pixel from a layer = img.layers[0] pdb.gimp_layer - by teapot - 04-06-2025, 03:34 AM

Forum Jump: