XPCE - how to read pixel value of an image

Dear community,

I wonder how to read out the pixel value of an image in xpce. I’m using SWI-Prolog version 7.2.2.

For a one-bit encoded bitmap this works (reading out pixel value at pixel position 20,20):

view1 :- 
        Xpos = 20,
	Ypos = 20,
	new(P,  picture),
	new(I, image('C:/test1.bmp')),
	new(Bmp, bitmap(I)),
	get(I, pixel, Xpos , Ypos, Value),
	write(Value),
	send(P, display ,Bmp),
	send(P,  open).

So I get either @on or @off, depending on the pixel, bitmap is displayed correctly.
But if I open an 8-bit gray valued bitmap:

view2 :- 
        Xpos = 20,
	Ypos = 20,
	new(P, picture),
	new(I, image('C:/baboon8bit.bmp')),
	new(Bmp, bitmap(I)),
	get(I, pixel, Xpos , Ypos, Value),
	write(Value),
	send(P, display, Bmp),
	send(P,  open).

Prolog returns false.
Without the get-method (get-clause) the image is displayed correctly.

Other ways I tried:

get(I, pixel(20,20), Value),  %   --> false.

get(I, pixel(20,20), R,G,B ), %  --> Type error.
	
get(I , pixel, 20,20, colour(Red,Yellow,Blue)), % --> false.
	
get(I , pixel, 20,20, colour(@default,Red,Yellow,Blue)), %  --> false.

Reading out size, depth and kind (bitmap | pixmap) works for both images.
Is there a correct way to get the pixel values?

Thanks, Tobi

What should work is get(I, pixel, 20, 20, Pixel). I can’t get it ti work either though. From very rusty memory I know this is pretty tricky depending on the image format and X11/Windows. For X11, the critical part is in packages/xpce/src/x11/xdraw.c, r_get_pixel(). I’m afraid xpce isn’t supported anymore except for making sure the Prolog development tools keep working. I’m happy to apply patches though.

 Sorry --- Jan