Scripting-Questions
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Scripting-Questions | oliver@first.in-berlin.de | 21 Aug 23:08 |
Scripting-Questions | Jerry Baker | 22 Aug 00:23 |
Scripting-Questions | oliver@first.in-berlin.de | 22 Aug 13:53 |
Scripting-Questions | Jerry Baker | 22 Aug 17:50 |
Scripting-Questions
1) .add-layer: how can I insert at the lowest position?
2) how can I script "Fit canvas to layers"?
3) gimp.* / pdb.* and so on: which names using for Python, when looking at the procedure browser?
For example: i could not find out, how to call
gimp-file-load-layer
I tried with gimp.* with pdb.* without that also
The procedure browser seems to be good for scheme-users, but for Python this is just a hint, and needs permanently dabbling around.
Where can I find better documentatoion for Python-scripting?
Ciao, Oliver
Scripting-Questions
Hi Oliver,
1) Insert a layer at lowest position... The image.add_layer method position argument is what you need to specify. 0 places a new layer at the top, 1 would be under the first layer, 2 under the second layer, etc... image.layers give you the list of layers in the image. Use len(image.layers) to place it at the bottom...
Console example:
>>> # Get Active Image
>>> image = gimp.image_list()[0]
>>>
>>> # Create a new layer
>>> new_layer = gimp.Layer(image, "My New Layer", image.width,
image.height, RGBA_IMAGE,100, NORMAL_MODE)
>>>
>>> # Add Layer Lowest Position
>>> image.add_layer(new_layer, len(image.layers))
2) Fit canvas to layers You'll want to use: gimp-image-resize-to-layers
Console:
>>> image = gimp.image_list()[0]
>>> pdb.gimp_image_resize_to_layers(image)
3) The current documentation at http://www.gimp.org/docs/python/index.html and the pdb is about the best we gimp-python users have. There are a few sites out there with some posts, but everything is pretty dated. I'm currently picking away at a full tutorial and complete updated reference which I'll post here when I get it completed. I'm about 75% completed with it.
On 08/21/2010 05:08 PM, oliver@first.in-berlin.de wrote:
1).add-layer: how can I insert at the lowest position?
2) how can I script "Fit canvas to layers"?
3) gimp.* / pdb.* and so on: which names using for Python, when looking at the procedure browser?
For example: i could not find out, how to call gimp-file-load-layer
I tried with gimp.* with pdb.* without that alsoThe procedure browser seems to be good for scheme-users, but for Python this is just a hint, and needs permanently dabbling around.
Where can I find better documentatoion for Python-scripting?
Ciao, Oliver
Scripting-Questions
Hi Jerry,
thanks for your hints.
Another question: I want to use "gimp-file-load-layer" and don't know how to access it.
Any idea?
Ciao, Oliver
On Sat, Aug 21, 2010 at 06:23:04PM -0400, Jerry Baker wrote:
Hi Oliver,
1) Insert a layer at lowest position... The image.add_layer method position argument is what you need to specify. 0 places a new layer at the top, 1 would be under the first layer, 2 under the second layer, etc... image.layers give you the list of layers in the image. Use len(image.layers) to place it at the bottom...
Console example:
# Get Active Image
image = gimp.image_list()[0]# Create a new layer new_layer = gimp.Layer(image, "My New Layer", image.width,
image.height, RGBA_IMAGE,100, NORMAL_MODE)
# Add Layer Lowest Position
image.add_layer(new_layer, len(image.layers))2) Fit canvas to layers
You'll want to use: gimp-image-resize-to-layersConsole:
image = gimp.image_list()[0]
pdb.gimp_image_resize_to_layers(image)3) The current documentation at
http://www.gimp.org/docs/python/index.html and the pdb is about the best we gimp-python users have. There are a few sites out there with some posts, but everything is pretty dated. I'm currently picking away at a full tutorial and complete updated reference which I'll post here when I get it completed. I'm about 75% completed with it.On 08/21/2010 05:08 PM, oliver@first.in-berlin.de wrote:
1).add-layer: how can I insert at the lowest position?
2) how can I script "Fit canvas to layers"?
3) gimp.* / pdb.* and so on: which names using for Python, when looking at the procedure browser?
For example: i could not find out, how to call gimp-file-load-layer
I tried with gimp.* with pdb.* without that alsoThe procedure browser seems to be good for scheme-users, but for Python this is just a hint, and needs permanently dabbling around.
Where can I find better documentatoion for Python-scripting?
Ciao, Oliver
Scripting-Questions
Console Example:
# Get Active Image
>>> image = gimp.image_list()[0]
# Load an image into a layer >>> loaded_layer = pdb.gimp_file_load_layer(image, "path/to/other_image.jpg")
# Add loaded layer to image >>> image.add_layer(loaded_layer, 0)
On 08/22/2010 07:53 AM, oliver@first.in-berlin.de wrote:
Hi Jerry,
thanks for your hints.
Another question: I want to use "gimp-file-load-layer" and don't know how to access it.
Any idea?
Ciao, Oliver
On Sat, Aug 21, 2010 at 06:23:04PM -0400, Jerry Baker wrote:
Hi Oliver,
1) Insert a layer at lowest position... The image.add_layer method position argument is what you need to specify. 0 places a new layer at the top, 1 would be under the first layer, 2 under the second layer, etc... image.layers give you the list of layers in the image. Use len(image.layers) to place it at the bottom...
Console example:
# Get Active Image
image = gimp.image_list()[0]# Create a new layer new_layer = gimp.Layer(image, "My New Layer", image.width,
image.height, RGBA_IMAGE,100, NORMAL_MODE)
# Add Layer Lowest Position
image.add_layer(new_layer, len(image.layers))2) Fit canvas to layers
You'll want to use: gimp-image-resize-to-layersConsole:
image = gimp.image_list()[0]
pdb.gimp_image_resize_to_layers(image)3) The current documentation at
http://www.gimp.org/docs/python/index.html and the pdb is about the best we gimp-python users have. There are a few sites out there with some posts, but everything is pretty dated. I'm currently picking away at a full tutorial and complete updated reference which I'll post here when I get it completed. I'm about 75% completed with it.On 08/21/2010 05:08 PM, oliver@first.in-berlin.de wrote:
1).add-layer: how can I insert at the lowest position?
2) how can I script "Fit canvas to layers"?
3) gimp.* / pdb.* and so on: which names using for Python, when looking at the procedure browser?
For example: i could not find out, how to call gimp-file-load-layer
I tried with gimp.* with pdb.* without that alsoThe procedure browser seems to be good for scheme-users, but for Python this is just a hint, and needs permanently dabbling around.
Where can I find better documentatoion for Python-scripting?
Ciao, Oliver