Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selected pixel count
#4
(03-12-2023, 12:13 AM)steven Brazzale Wrote: Thanks For That Ofnuts.
I've got it to work, but not with
Code:
image=image=[x for x in gimp.image_list() if image.ID==5][0]
making sure the ID matches the Gimp Image number - i keep getting the error :-

Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'image' is not defined

 But I am only using one image, so I can just use
Code:
theImage = gimp.image_list()[0]
Also is there anyway I can get this number directly into the clipboard?
Cheers
Steven

1) Sorry, typo, only one image=:

Code:
image=[x for x in gimp.image_list() if image.ID==5][0]

2) Yes, you can hardcode gimp.image_list()[0] but you'll get burned sooner or later. Of course if you do a true plugin instead of pasting code in the Python console you get the image passed as a plugin parameter.

3) Possibly, but this is heavily system dependent. On Linux, there is a CLI utility to stuff things in the clipboard and it can be called from Python. I don't know if it is as simple in Windows (or even possible). But IMHO you could skip the clipboard and write directly in a file.
Reply


Messages In This Thread
Selected pixel count - by steven Brazzale - 03-10-2023, 12:36 AM
RE: Selected pixel count - by Ofnuts - 03-10-2023, 08:04 AM
RE: Selected pixel count - by steven Brazzale - 03-12-2023, 12:13 AM
RE: Selected pixel count - by Ofnuts - 03-12-2023, 02:03 PM
RE: Selected pixel count - by steven Brazzale - 03-14-2023, 05:36 AM

Forum Jump: