Pythonの書式に従ってタブ下げすればよかった。
Hello Worldのサンプルに付け足した。
#!/usr/bin/python
from gimpfu import *
import gimpfu,time
from datetime import date
def plugin_main(image, drawable):
theImage=gimp.image_list()[0]
lay=theImage.active_layer
drawable = pdb.script_fu_separate_luminance(theImage, TRUE, FALSE)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Lum")
pdb.gimp_levels_auto(active_layer)
pdb.gimp_image_set_active_layer(theImage, active_layer)
pdb.script_fu_advanced_tone_mapping(theImage, active_layer, 10, 75, 90, 2)
active_layer = pdb.gimp_image_get_active_layer(theImage)
pdb.gimp_levels_auto(active_layer)
pdb.gimp_image_lower_layer(theImage, active_layer)
pdb.gimp_image_lower_layer(theImage, active_layer)
new_layer=theImage.add_layer(pdb.gimp_layer_copy(active_layer, True),-1)
layer=theImage.active_layer
active_layer=pdb.gimp_drawable_set_name(layer, 'ToneMapcopy1')
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Chroma")
new_layer=theImage.add_layer(pdb.gimp_layer_copy(active_layer, True),-1)
layer=theImage.active_layer
active_layer=pdb.gimp_drawable_set_name(layer, 'Chromacopy')
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Lum")
pdb.gimp_image_lower_layer(theImage, active_layer)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "ToneMapcopy1")
pdb.gimp_image_raise_layer(theImage, active_layer)
pdb.gimp_image_raise_layer(theImage, active_layer)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Chromacopy")
pdb.gimp_displays_flush()
pdb.script_fu_sg_copy_mask_from_above(theImage, active_layer)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Chromacopy")
pdb.gimp_image_raise_layer_to_top(theImage, active_layer)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "Lum")
pdb.gimp_image_raise_layer(theImage, active_layer)
mask = pdb.gimp_layer_create_mask(active_layer, 5)
pdb.gimp_layer_add_mask(active_layer, mask)
pdb.gimp_invert(mask)
pdb.gimp_layer_set_mode(active_layer, 4)
active_layer = pdb.gimp_image_get_layer_by_name(theImage, "ToneMapcopy1")
mask = pdb.gimp_layer_create_mask(active_layer, 5)
pdb.gimp_layer_add_mask(active_layer, mask)
pdb.gimp_invert(mask)
pdb.gimp_layer_set_mode(active_layer, 5)
pdb.gimp_displays_flush()
register(
"python_fu_resize",
"Saves the image at a maximum width and height",
"Saves the image at a maximum width and height",
"Nathan A. Good",
"Nathan A. Good",
"2010",
"<Image>/Image/Resize to max...",
"RGB*, GRAY*",
[],
[],
plugin_main)
main()