python-fu

GIMP Python-fu exporting file only exports transparent layer

浪尽此生 提交于 2019-12-04 11:21:45
I am having issues saving images in python via GIMP. I can get the image and apply the effects I want, but when I go to save, it only saves one layer and not everything (NOTE: The background is transparent) and because the background is transparent, I cannot get it to save anything besides the transparent background. The code I am using is posted below: image_array = gimp.image_list() i=0 for image in image_array: img = image_array[i] layers = img.layers last_layer = len(layers)-1 try: disable=pdb.gimp_image_undo_disable(img) pdb.gimp_layer_add_alpha(layers[0]) drw = pdb.gimp_image_active

How do I save (export) all layers with gimp's script fu?

南楼画角 提交于 2019-12-03 06:37:50
With gimp fu, I can save the content of one layer (at least, that is how I interprete the definition of gimp_file_save because it takes the parameter drawable ). Now, I have the following script: from gimpfu import * def write_text(): width = 400 height = 100 img = gimp.Image(width, height, RGB) img.disable_undo() gimp.set_foreground( (255, 100, 20) ) gimp.set_background( ( 0, 15, 40) ) background_layer = gimp.Layer( img, 'Background', width, height, RGB_IMAGE, 100, NORMAL_MODE) img.add_layer(background_layer, 0) background_layer.fill(BACKGROUND_FILL) text_layer = pdb.gimp_text_fontname( img,

Writing a GIMP python script

我们两清 提交于 2019-12-03 06:10:02
问题 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...)? Update: I did this: subprocess.Popen(["gimp", "--batch-interpreter" , "python-fu-eval" , "-b" ,"\'import sys; sys.path.append(\"/home/antoni4040\"); import gimpp; from gimpfu import *; gimpp.main()\'"]) ,but, even if the console says