title: Writing a GIMP python script
body: <p>What I want to do is to open gimp from a python program (with subprocess.Popen, perhaps), and in the same time, gimp will start with a python script that will open an image and add a layer... Well, how can I achieve that(I wish GIMP had better documentation...)?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I did this: <code>subprocess.Popen(["gimp", "--batch-interpreter" , "python-fu-eval" , "-b" ,"\'import sys; sys.path.append(\"/home/antoni4040\"); import gimpp; from gimpfu import *; gimpp.main()\'"])</code> ,but, even if the console says "batch command executed successfully", nothing happens... </p>
  
  <p><strong>Update2:</strong></p>
  
  <pre><code>from gimpfu import *
  
  def gimpp():
      g = gimp.pdb
      images = gimp.image_list() 
      my_image = images[0]
      layers = my_image.layers
      new_image = g.gimp_file_load_layer("/home/antoni4040/Έγγραφα/Layout.png")
      my_image.add_layer(new_image)
      new_layer = g.gimp_layers_new(my_image,  1024, 1024, RGBA_IMAGE, "PaintHere", 0, NORMAL_MODE)
      my_image.add_layer(new_layer)
  
  register('GimpSync', "Sync Gimp with Blender", "", "", "", "", "&lt;Image&gt;/SyncWithBlender", '*', [], [], gimpp)
  
  main()   
  </code></pre>