The "drawable" parameter of the script is the active layer when the script is called, so you don't really need that extra "layer" parameter, consider "drawable" as your layer (you can even rename the function parameter). Your code shows a bit of confusion about layers. (PF_INT, "thickness", "Box Thickness", 5), (PF_DRAWABLE, "drawable", "Drawable", None), "RGBA", # Create a new image, don't work on an existing one "Create a white box around active layer", Pdb.plug_in_autocrop_layer(img, pdb.gimp_image_get_active_drawable(img)) Pdb.gimp_edit_fill(pdb.gimp_image_get_active_drawable(img), 2) Pdb.gimp_image_set_active_layer(img, box) Pdb.gimp_message("Removed layer from selection") Pdb.gimp_image_select_item(img, 1, layer) Pdb.gimp_message("Selected a border with a thickness of " + str(thickness)) Pdb.gimp_selection_border(img, thickness) Pdb.gimp_image_select_item(img, 0, layer) # pdb.gimp_layer_resize_to_image_size(layer) Pdb.gimp_image_insert_layer(img, box, None, -1) # layer = pdb.gimp_image_get_active_layer(img)īox = pdb.gimp_layer_new(img, 1, 1, 1, pdb.gimp_item_get_name(layer) + "_white box", 100, 0) Pdb.plug_in_autocrop_layer(img, drawable) It first creates a secondary layer for the border, then it resizes it to fit the canvas, then it selects the outline of the active layer (Alpha to Selection in "normal" GIMP), borders it, removes the outline of the active layer to preserve pixels on the layer, then it grows the border by 1, sharpens it and fills it.īut sometimes it seems to select the whole layer instead of the outline of it, is this a GIMP bug, or did I do something wrong? #!/usr/bin/env pythonĭef white_box(img, drawable, thickness = 5, layer = None): Once you’ve stamped it, you can’t change the date afterward.So I'm making my first gimp plugin with python. In other words, GIMP turns your text into a picture of the text, sort of like pressing a well-inked date stamp onto a page. When you create a new textbox with the Text tool, GIMP stores any text you type in as vector shapes – but once you apply any edits to the layer, GIMP will rasterize the text, a process that converts the editable vector data into pixels. Saving your work is simply storing it again for future use in GIMP, which is why GIMP forces you to choose the XCF format if you open the File menu and choose Save or Save As.Įxporting your image is preparing it for sharing with someone else, and so has a whole separate set of processes for each different format type, but only a few like PSD and TIFF support saving layers, and even then you may run into issues depending on the compatibility of different editors. GIMP makes a big deal of separating the two concepts of saving your work and exporting your work. The Save command now defaults to the XCF format which preserves your text layer data This will allow you to store all the possible information GIMP has about your file, including the various layers, masks, paths, and any other content that would be lost by saving it in a flattened format like JPG. Instead, it’s best to use GIMP’s native XCF file format. JPG is the most popular image format in the world, but it’s not designed to store layer data, so it won’t be good enough to store your text in an editable format. If you want to be able to edit your text layer in a future editing session, you’ll need to save your file in a format that supports layers. If you’ve got the time, read on for an explanation of why GIMP works like this and what you can do to stop it from happening next time you need to edit text in GIMP. You can either use the Undo command until it’s editable again or re-create the whole text layer from scratch.Īs I said at the beginning, working with text in GIMP can be very difficult. If these methods didn’t work for you, then you might have accidentally converted your text into pixels, which means it’s no longer editable as text. Edit Text on canvas is hidden in the Layer properties menuEdit Text on canvas is hidden in the Layer properties menu
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |