예제 #1
0
def create_shadow_layer():
    global shadow_layer_id
    image.do_begin()
    if shadow_layer_id != None:
        layer.select_id(shadow_layer_id)
        layer.remove()
    layer.select_id(source_layer_id)
    layer.duplicate()
    layer.rasterize()
    layer.set_name(FRIENDLY_NAME + " of " + source_layer_name)
    layer.set_registry(REGISTRY_NAME + "-source-layer-id", source_layer_id)
    shadow_layer_id = layer.get_id()
    layer.set_registry("overlay-color", overlay_color)
    layer.set_opacity(chosen_opacity)
    image.do_end()
def create_shadow_layer():
    global shadow_layer_id
    image.do_begin()
    if shadow_layer_id != None:
        layer.select_id(shadow_layer_id)
        layer.remove()
    layer.select_id(source_layer_id)
    layer.duplicate()
    layer.set_name(FRIENDLY_NAME + " - " + source_layer_name)
    layer.set_registry("shadow-source-layer-id", source_layer_id)
    shadow_layer_id = layer.get_id()
    shadow_index = image.get_layer_index()
    image.move_layer_index(shadow_index, shadow_index - 1)
    filters.filter_function(red=overlay_color.red / 255,
                            green=overlay_color.green / 255,
                            blue=overlay_color.blue / 255,
                            gamma_correction=False)
    layer.set_registry("overlay-color", overlay_color)
    layer.set_opacity(chosen_opacity)
    image.do_end()
예제 #3
0
        else:
            file_format = "BMP"
        temp_name = layer.save_as(temp_name, file_format)
        if temp_name is None:
            dialog.show_message("Failed to retrieve layer")
            exit()
        channels[ch] = Image.open(temp_name).getchannel(ch)

merged = Image.merge(
    "RGBA", [channels["R"], channels["G"], channels["B"], channels["A"]])
merged.save(temp_name, "PNG")

for ch_id in channels_id:
    if image.contains_layer_id(ch_id):
        layer.select_id(ch_id)
        layer.remove()

layer.add_from_file(temp_name)
layer.set_name("Merged channels")
new_layer_id = layer.get_id()
new_layer_index = image.get_layer_index()

if image.contains_layer_id(layer_id):
    layer.select_id(layer_id)
    layer_index = image.get_layer_index()
    layer_name = layer.get_name()
    layer_opacity = layer.get_opacity()
    image.move_layer_index(new_layer_index, layer_index + 1)
    layer.select_id(layer_id)
    layer.remove()
    layer.select_id(new_layer_id)