Gimptalk - Premier Gimp Community: script gimp python for groups - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

script gimp python for groups

#1 User is offline   sabativi 

  • Member
  • PipPip
  • Group: Members
  • Posts: 16
  • Joined: 24-July 12

Posted 10 August 2012 - 01:45 PM

Hello,

As group is available since gimp 2.8, I am trying to manipulate them.

I write a script just to create a new group in a psd file :
def kujjuk(inImage,layerToAdd):
inImage=gimp.pdb.gimp_file_load(inImage,inImage)

layer=gimp.pdb.gimp_image_get_active_layer(inImage)

if gimp.pdb.gimp_item_is_group(layer) is not True:
group1=gimp.pdb.gimp_layer_group_new(inImage)

gimp.pdb.gimp_image_set_active_layer(inImage,layer)

gimp.pdb.gimp_item_set_name(group1,"shooting")

gimp.pdb.gimp_image_insert_layer(inImage,group1,0,-1)

pdb.gimp_file_save(inImage,gimp.pdb.gimp_image_get_active_layer(inImage),"group.psd","group.psd")

gimp.pdb.gimp_image_delete(inImage)

I get the following error :

gimp.pdb.gimp_image_insert_layer(inImage,group1,0,-1)
TypeError: wrong parameter type
batch command experienced an execution error

Could you indicate me where is the mistake ?

I have looked at the docs but found nothing

thakns ni advance

sabativi
0

#2 User is online   ofnuts 

  • Moderator GT
  • Group: Moderators
  • Posts: 1,302
  • Joined: 17-October 10
  • LocationLooking over your shoulder :)

Posted 10 August 2012 - 02:25 PM

Looks like the doc is a bit wrong, if you want to add a parentless group, use:
pdb.gimp_image_insert_layer(inImage,group1,None,-1)

Btw, you don't need to prefix everything with 'gimp.'.

You can also use:
inImage.add_layer(group1)

This post has been edited by ofnuts: 10 August 2012 - 02:26 PM

010011110110011001101110011101010111010001110011
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic