Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Searching for python script islands to layers
#11
1) No, I don't know what you mean. Are you taking in account the fact that the Y coordinates go down and not up?

2) The layer variable is actually a Python object(*) with  a writable "name" attribute, so you can do something like:
Code:
layer.name="Layer %03d" % some_sequence_number

or even
Code:
layer.name="Object @(%3d,%3d)" % (i*sample,j*sample)

Speaking of "i*sample", a seasoned Pythonista would loop like this:

[code]
for x in range(0,img.width,sample):
   for y in range(0,img.height,sample):
        # and use x,y instead of i*sample,j*sample
[code]

(*) Most things you manipulate are: image, drawable, layer (subclass of drawable), channel... and they  have methods that wrap the most used pdb.* calls. See this not so complete doc and if you are curious, do a "dir(image)" or "dir(layer)" or "dir(gimp)" in your Python console.
Reply


Messages In This Thread
RE: Searching for python script islands to layers - by Ofnuts - 01-22-2018, 10:52 PM

Forum Jump: