![]() Pdb.gimp_image_select_rectangle(imgNew, CHANNEL_OP_REPLACE, xgoal, ygoal, orglayer.width, 60)įloatselection = pdb.gimp_edit_paste(newLayer, FALSE) Pdb.gimp_floating_sel_anchor(floatingLayer) # Anchor the floating selection before making another selection def copy_test123(image):įloatingLayer = pdb.gimp_edit_paste(newLayer, FALSE) Thanks to for the answer, for anyone stumble on this, here is the adjusted code to get the desired result. Which selection, the current selection in the image where you are pasting, or selection of the part you just copied? And why would you use that as a mask?Īnyone know what I'm doing wrong here, and how I can get the expected result? But if I uncomment/activate the code for step 4 and 5 then the result is only the top part and also it's in the incorrect position, it should be slightly higher in the image.ītw also, in the GIMP api documentation under gimp_edit_paste it says you can copy "behind" the selection and use the selection as a mask, but I don't understand what that means. If I leave step 4 and 5 commented out, as it is in the example code, then it shows just the new image without an extra copy of the top part, as expected. However the result is not what I expected, see screenshot below. # Create and show a new image window for our spritesheet # pdb.gimp_layer_translate(floatselection, xOffset, yOffset) # xOffset, yOffset = floatselection.offsets # 5) move the new extra top part slightly above the image # floatselection = pdb.gimp_edit_paste(newLayer, TRUE) # pdb.gimp_image_select_rectangle(imgNew, CHANNEL_OP_REPLACE, xgoal, ygoal, orglayer.width, 60) # 4) copy the top part of the newly added image part # NOW COPY THE TOP BAR (60 pixels high) FROM THE PASTED SELECTION Pdb.gimp_layer_translate(floatingLayer, xOffset, yOffset) # Move the floating layer into the correct position # 3) Floating layer defaults to center, more to 120,80 # 2) Copy layer from original layer and paste it into a "floating" layer in the new imageįloatingLayer = pdb.gimp_edit_paste(newLayer, TRUE) NewLayer = gimp.Layer(imgNew, "copytest", 640, 480, RGBA_IMAGE, 100, NORMAL_MODE) paste the top part slightly above the goal locationĪnd here is the code def copy_test123(image):.To test this I did the following in a Python macro Meaning that I want to extend each image a pixels to the top, bottom, left and/or right. ![]() For the tile processing of a game, I want to copy many layers (=images) into one new image and "extrude" each image. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |