Just starting out with python-fu in Gimp. I'm trying to emulate in python what I can do in the UI:
Here's what I have:
img=pdb.gimp_image_new(1000, 500, 0)
lyr=pdb.gimp_file_load_layer(img,'C:\temp/file1.png')
pdb.gimp_image_insert_layer(img, lyr, None, 0)
#here's where I'm lost... how do I save as png with the transparent border? The following saves just as 800px wide, and loses the 100px transparency on either side...
drw=pdb.gimp_image_active_drawable(img)
pdb.file_png_save2(img,drw,'C:\temp/file2.png', 'C:\temp/file2.png',0,9,0,0,0,1,1,1,1)
Any help gratefully received! :)
I found a solution, by creating a separate transparent background png that is 1000px * 500px, adding that as an extra layer, and merging the two layers, clipped to the image size:
img=pdb.gimp_image_new(1000, 500, 0)
lyr=pdb.gimp_file_load_layer(img,'C:\temp/file1.png')
pdb.gimp_image_insert_layer(img, lyr, None, 0)
lyr2=pdb.gimp_file_load_layer(img,'C:\temp/bg.png')
pdb.gimp_image_insert_layer(img, lyr2, None, 0)
pdb.gimp_image_merge_visible_layers(img,CLIP_TO_IMAGE)
drw=pdb.gimp_image_active_drawable(img)
pdb.file_png_save2(img,drw,'C:\temp/file2.png', 'C:\temp/file2.png',0,9,0,0,0,1,1,1,1)