Sun Apr 07, 2019 10:20 pm
def SmartSharpen_1(image, layer):
# Create a rough edge mask from current layer
# make copy of active layer; name it 'EDGE-MASK'; desaturate the EDGE-MASK:
# run EDGE-DETECT plugin on EDGE-MASK layer:
# run Color>Levels on EDGE-MASK layer.
# -----------------------------------------------------------------------------
# user should now manually clean up any problems with the EDGE-MASK; before running ....part2...
#------------------------------------------------------------------------------
def SmartSharpen_2(image, layer):
# use layer EDGE-MASK for sharpening the layer directly below it [since that is where 'SmartSharpen_1()' left the original photo]:
# create the channel 'EDGES'; copy layer 'EDGE-MASK' into channel 'EDGES'; copy 'EDGES' into {selection}; and hide 'EDGES':
# make 'EDGE-MASK' the active layer; delete 'EDGE-MASK'; which should make the original photo the active layer:
... code above removed for Brevity... full code below:
# make a copy of the original photo layer; do mods on the copy!; run UNSHARP plug-in; invert the selection; run GAUSSIAN plugin; clear the selection:
layer = image.active_layer.copy(True) #\ make a COPY OF original photo.
image.add_layer( layer, -1) #/
image.active_layer = layer # [i.e. work on a backup copy only]
pdb.gimp_selection_grow( image, 1)
pdb.plug_in_unsharp_mask( image, layer, 3.0, 0.65, 0)
pdb.gimp_selection_invert( image)
# --------------- execution stops here for some reason -------------------
pdb.plug_in_gauss_iir2( image, layer, 0.9, 0.9, 0)
pdb.gimp_selection_none( image)
image.undo_group_end()
pdb.gimp_displays_flush()
Sun Apr 07, 2019 11:54 pm
Mon Apr 08, 2019 1:17 am
image.undo_group_start()
try:
[ .. insert your code here ..]
except Exception as e:
print e.args[0]
gimp.message(e.args[0])
image.undo_group_end()
Mon Apr 08, 2019 3:12 am
Mon Apr 08, 2019 12:55 pm
Tue Apr 09, 2019 12:25 pm
KevinYork wrote:(grrrr..... never mind; I found my stupidity.
I was reading documentation on pdb.plug_in_gauss() ...but typed in pdb.plug_in_gauss_iir2(). which has fewer parameters)
Script runs fine now...
Many thanks for the quick response! As this was my first Python script; I do fear I will be posting more questions.