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
#2
(04-04-2025, 09:09 PM)TheInstinct Wrote: Hi everybody,

I'm facing a serious problem when porting a plugin I wrote in Gimp 2.10 to Gimp 3.0 in python.

In Gimp 2, I used the following way to the color index of each pixel. It works very well:
Code:
layer = img.layers[0]
region = layer.get_pixel_rgn(0, 0, img.width, img.height, False, False)
pixels = array("B", region[0:img.width, 0:img.height])
pixels contains the index of the color [0;255] which is a byte.

In Gimp 3, you can get access to color information of the layer by using layer.get_buffer(...) but you won't get the color index as you must provide a Babl format. So you will get a color, or luminance in the format you selected "RGB u8" for example, but you won't get the indexes of the colors used by each pixel.

I made research but can't find how to get color index of each pixel. I hope some of you will be able to help me.

Thank you in advance for your support.

Can you show you current Gimp3 code?
Reply


Messages In This Thread
RE: Gimp 3: get indexed of each pixel from a layer = img.layers[0] pdb.gimp_layer - by Ofnuts - 04-05-2025, 01:24 PM

Forum Jump: