def pythonSaveToPSD(image):

    # Prep
    pdb.gimp_image_undo_group_start(image)
    pdb.gimp_context_push()

    # Code
    drawable = pdb.gimp_image_get_active_drawable(image)
    filename = pdb.gimp_image_get_filename(image)
    temp = filename.replace("_CLEAN", "")
    temp2 = temp.replace("_EDIT", "")
    temp = temp2.replace("_XCF", "")
    filename = temp.replace("_PSD", "")
    path = os.path.dirname(filename)
    path += "_PSD"
    name = os.path.basename(filename)
    out_psd = os.path.join(path, name)
    out_psd = os.path.splitext(out_psd)[0] + '.psd'

    # Create folder
    if not os.path.exists(path):
        os.makedirs(path)

    # Save in PSD
    pdb.gimp_file_save(image, drawable, out_psd, out_psd)
    pdb.gimp_image_clean_all(image)

    # Finish
    pdb.gimp_context_pop()
    pdb.gimp_image_undo_group_end(image)
    pdb.gimp_displays_flush()
Ejemplo n.º 2
0
 def init(self, ranges, position, space):
     select_action = space.create_selection_action(self.src_image)
     select_action(position)
     drawable = pdb.gimp_image_get_active_drawable(self.src_image)
     red = pdb.gimp_histogram(drawable, HISTOGRAM_RED, 0, 255)[0] / 255
     green = pdb.gimp_histogram(drawable, HISTOGRAM_GREEN, 0, 255)[0] / 255
     blue = pdb.gimp_histogram(drawable, HISTOGRAM_BLUE, 0, 255)[0] / 255
     return Argument(0, 1, red), Argument(0, 1, green), Argument(
         0, 1, blue), Argument(0, 1, 0.8)
def pythonSaveToEdit(image):

    # Prep
    pdb.gimp_image_undo_group_start(image)
    pdb.gimp_context_push()

    # Code
    drawable = pdb.gimp_image_get_active_drawable(image)
    filename = pdb.gimp_image_get_filename(image)
    temp = filename.replace("_CLEAN", "")
    temp2 = temp.replace("_EDIT", "")
    filename = temp2.replace("_XCF", "")
    path = os.path.dirname(filename)
    path2 = os.path.dirname(filename)
    path += "_EDIT"
    path2 += "_XCF"
    name = os.path.basename(filename)
    out_file = os.path.join(path, name)
    out_xcf = os.path.join(path2, name)
    out_file = os.path.splitext(out_file)[0] + '.jpg'
    out_xcf = os.path.splitext(out_xcf)[0] + '.xcf'

    # Create folders
    if not os.path.exists(path):
        os.makedirs(path)
    if not os.path.exists(path2):
        os.makedirs(path2)

    # Merge visible layers in an image and export in jppeg
    new_image = pdb.gimp_image_duplicate(image)
    layer = pdb.gimp_image_merge_visible_layers(new_image, CLIP_TO_IMAGE)
    pdb.gimp_file_save(new_image, layer, out_file, out_file)
    pdb.gimp_image_delete(new_image)
    # Save in XCF
    pdb.gimp_file_save(image, drawable, out_xcf, out_xcf)
    pdb.gimp_image_clean_all(image)

    # Finish
    pdb.gimp_context_pop()
    pdb.gimp_image_undo_group_end(image)
    pdb.gimp_displays_flush()
Ejemplo n.º 4
0
def texte(inR,inG,inB,inFichier,highlight_text,change_numero):
    print("\tLoading image {}".format(inFichier))
    image = pdb.gimp_file_load(inFichier,inFichier)
    color = (inR,inG,inB)

    # pdb.gimp_display_new(image)
    if highlight_text:
        print("\t\tHighlighting text...")
        effet_texte(color, image)
    
    if change_numero > 0:
        print("\t\tChanging number...")
        change_num(image, change_numero)
    
    pdb.gimp_selection_none(image)
    layer_id = pdb.gimp_image_get_layers(image)[1][0]
    layer = gimp.Item.from_id(layer_id)
    pdb.script_fu_add_bevel(image, layer, 5, False, False)
    drawable = pdb.gimp_image_get_active_drawable(image)

    pdb.file_png_save(image, drawable, inFichier, inFichier,
                        0,5,0,0,0,0,0) 
    pdb.gimp_image_delete(image)