dialog.show_message(translation["Layer is empty"]) exit() ############ image processing FRIENDLY_NAME = dialog.get_script_name() MAX_RADIUS = 100 MAX_OFFSET = 100 MAX_OPACITY = 255 source_layer_id = layer.get_registry("shadow-source-layer-id") if source_layer_id is not None: layer.select_id(source_layer_id) else: source_layer_id = layer.get_id() source_layer_name = layer.get_name() chosen_radius = layer.get_registry("shadow-radius") if chosen_radius == None: chosen_radius = image.get_registry("shadow-radius") if chosen_radius == None: chosen_radius = 10 chosen_offset = layer.get_registry("shadow-offset") if chosen_offset == None or len(chosen_offset) != 2: chosen_offset = image.get_registry("shadow-offset") if chosen_offset == None or len(chosen_offset) != 2: chosen_offset = (10, 10) shadow_layer_id = layer.get_registry("shadow-layer-id") if image.get_layer_index(shadow_layer_id) == None:
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) layer.set_name(layer_name) layer.set_opacity(layer_opacity) image.do_end()