Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Volunteers needed to run a select-polygon test
#1
Windows 10
Gimp 3.0.0 RC1

Hi,

I'm looking for volunteer(s) to run this test plug-in. The plug-in creates an image and selects a square polygon at the topleft of the image.

At least that what's it's supposed to do. However, the plug-in will crash while failing to select the polygon. The failure appears to be in the procedure: 'gimp-image-select-polygon'.

Code:
       procedure = Gimp.get_pdb().lookup_procedure(
           'gimp-image-select-polygon'
       )
       config = procedure.create_config()
       config.set_property('image', image)
       config.set_property('operation', Gimp.ChannelOps.REPLACE)

       # Define a square of four points
       # positioned at the topleft of the image.
       config.set_property(
           'segs', (0., 0., 250., 0., 250., 250., 250., 0.)
       )
       procedure.run(config)

I'm willing to report the bug to Gimp.org, but I believe it's a good idea to have some proof before doing so. There's also the possibility that I'm doing something wrong, and someone could point that out.

To install the plug-in copy the folder into a Gimp 3 plug-in folder. After Gimp is restarted, the plug-in will appear on the Gimp window menu under "Development".

Thanks for your attention.

.zip   SelectPolygonTest.zip (Size: 1.35 KB / Downloads: 13)
Reply
#2
You can simplify that command like so:

images.select_polygon (Gimp.ChannelOps.REPLACE, (0, 0, 250, 0, 250, 250))

That worked for me when I ran it on its own, if that helps.
Reply
#3
@gasMask
Just tested ... does not work for me.
Produces a new image, but no selection.


This is the error message I get in the termínal window:
Code:
Traceback (most recent call last):
 File "~/.var/app/org.gimp.GIMP/config/GIMP/3.0/plug-ins/SelectPolygonTest/SelectPolygonTest.py", line 91, in run
   config.set_property(
TypeError: could not convert (0.0, 0.0, 250.0, 0.0, 250.0, 250.0, 250.0, 0.0) to type 'GimpDoubleArray' when setting property 'GimpProcedureConfig-gimp-image-select-polygon.segs'

(of course the plugins are not in .var but in .config  :-( )

Nevertheless: I usually would do it the way CMYK Student suggested.
Reply
#4
Just tested.
For me it worked. 

I got the following messages in the terminal. Looked like an error but in the Gimp-window was a new image and selected.
(Ubuntu 22.04)

Traceback (most recent call last):
  File "/home/wiel/Gimp3/plugins/SelectPolygonTest/SelectPolygonTest.py", line 91, in run
    config.set_property(
TypeError: could not convert (0.0, 0.0, 250.0, 0.0, 250.0, 250.0, 250.0, 0.0) to type 'GimpDoubleArray' when setting property 'GimpProcedureConfig-gimp-image-select-polygon.segs'

(SelectPolygonTest.py:96): LibGimp-WARNING **: 10:04:44.918: _gimp_procedure_run_array: no return values, shouldn't happen
/home/wiel/Gimp3/plugins/SelectPolygonTest/SelectPolygonTest.py:102: Warning: g_error_new: assertion 'domain != 0' failed
  Gimp.main(TestImageScale.__gtype__, sys.argv)
Reply
#5
It's not a selection ... only an active new image.
Reply
#6
I screwed up the test. the polygon points were misconfigured. This is a revised version, but the error persists for me. The image has no selection.

MrsP-from-C, thank you for your help. I could still use a verification with this test. Any feedback could make Gimp development team's job easier.

Code:
       procedure = Gimp.get_pdb().lookup_procedure(
           'gimp-image-select-polygon'
       )
       config = procedure.create_config()
       config.set_property('image', image)
       config.set_property('operation', Gimp.ChannelOps.REPLACE)

       # Define a square of four points
       # positioned at the topleft of the image.
       # (x, y, ...)
       config.set_property(
           'segs', (
               0., 0.,
               250., 0.,
               250., 250.,
               0., 250.
           )
       )
       procedure.run(config)

The 'image.select_polygon' function works for me too.

With gimp-image-select-polygon', I believe the problem lies with 'GimpDoubleArray' which could have a wider impact.

.zip   SelectPolygonTest v.01.zip (Size: 1.51 KB / Downloads: 2)
Reply
#7
Still no selection created.
I thought it could be because of the point values 0.0 and so.
But changing to integers didn't help either.
So I wonder what is supposed to fit in there?
It wants a 'GimpDoubleArray'  whatever that is ... No idea of how to create that.
Reply
#8
Thank you MrsP-from-C for your help. I've posted an issue.
Reply


Forum Jump: