Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
script to merge files into layers and set a layer mask
#5
Hallo,

based on Kevins script I wrote the code, below.

When I copy and paste the code into Gimp's python console, it works fine. 
However, when I want to run the code outside Gimp (e.g. by double clicking
GIMP 2/bin/python.exe), it cannot import from gimpfu.




Code:
ImportError: No module named gimpfu


My script code:


Code:
import os,glob
from gimpfu import *

ctrl = 0
os.chdir('D:/z')
for tiffile in glob.glob('*tif'):
  print tiffile
  tiffile = 'D:/z/' + tiffile
  if ctrl == 0:
    image = pdb.gimp_file_load(tiffile,tiffile)
    ctrl = 1
  else:
    newlayer = pdb.gimp_file_load_layer(image, tiffile)
    image.add_layer(newlayer, -1)
    newlayer.mode = LAYER_MODE_GRAIN_MERGE
    mask_channel = newlayer.create_mask(ADD_MASK_WHITE)
    newlayer.add_mask(mask_channel)

pdb.gimp_display_new(image)
gimp.displays_flush()
Reply


Messages In This Thread
RE: script to merge files into layers and set a layer mask - by DanielDD - 09-16-2020, 11:19 PM

Forum Jump: