1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script-Fu Cut, Copy, and Paste Multiple Layers 2.0

This plugin contains three Script-Fu scripts

  1. Average Joe
    Description:

    This plugin contains three Script-Fu scripts: "Float Linked Layers (Cut)", "Float Linked Layers (Copy)", and "Merge Linked Layers (Paste)". The scripts will appear under "Script-Fu->Multi-Layer-Cut-Copy-Paste" menu. These scripts allow you to cut or copy a selection from multiple layers, manipulate the resulting multi-layer selection, and then paste the data from each layer back down into its original layer. I use it in creating sprites. I create one multiple layer image, perhaps 64x128 pixels in size, in which one layer might be the head, then the torso in another layer, a layer for each arm, a layer for each leg, etc. I then link the layers together and select the whole image. I then change the canvas size to be, e.g., 8 times as wide as it originally was. I then us "Copy" to create a copy of all layers at once, use the move tool to move it over 64 pixels, and use "Paste" to paste all of the data from the temporary copies into their original layers. I then repeat the process six more times (making sure to only have the original 64x128 space selected. I end up with 8 perfect, multi-layer replicas. At this point I unlink all of the layers. I can then manipulate individual parts of each of the "frames" without altering other parts of the image (since the other parts remain in other layers. If I wish to work on two parts at once (say rotate both an upper and lower arm around a common origin), I can link those two layers, create a selection that encompases only the area I wish to manipulate, "Cut" that section, and then operate on both layers independent of any other parts of those layers, and "Paste" them back to their proper layers when I am done. You, of course, can use it however you like.

    Usage:

    To use this plugin, link together the layers you wish to manipulate, create a selection that encompasses all or part of the linked layers (whichever part you want to operate on), and then choose either "Float Linked Layers (Cut)" or "Float Linked Layers (Copy)" from the "Script-Fu->Multi-Layer-Cut-Copy-Paste" menu.

    Assuming that you linked together the desired layers and made a selection, you will now have new, floating layers above each of the linked layers. The original layers will be unlinked as a result. Instead, these new floating layers will be linked together and can be manipulated jointly as though they were one layer using various transformation tools such as the move tool, the rotation tool, and the scaling tool. Other operations that work on linked layers should also work on these temporary layers.

    When you have finished the desired operations, select "Merge Down Linked Layers (Paste)" from the "Script-Fu->Multi-Layer-Cut-Copy-Paste" menu. Provided that you have not unlinked any of the temporary layers that were created, created any new layers in the interim, or deleted any layers in the interim, the image data contained in each of the temporary layers which were created will be moved back into the layer from which it originally came, the temporary layers will be automatically deleted, and the layers which were originally linked will be re-linked. The results may vary if you create new layers or delete existing layers between the time that you originally cut/copy the selection from the linked layers and the time that you paste the selected material back down.

    The "Cut" and "Paste" scripts were created by Saul Goode, dated 12/16/2006, and released under the terms of the GPLv2. I have made minor cosmetic changes to those scripts (essentially limited to renaming them and moving them into a sub-menu under Script-Fu). The "Copy" script is a derivative work of the "Cut" script which I originally created on April 3, 2010. It is, of course, released under the terms of the GPLv2.

    The scripts have been tested in Gimp v2.6.8. There is nothing peculiar to them that should proclude their use in the 2.4 series but I haven't tested them in it so I cannot provide assurances that they will work as expected. They may also work in earlier versions of Gimp but there are no guarantees at all.

    Installation Instructions:

    Download the "deep-float-copy.scm" file and place it in the "scripts" directory of your Gimp installation. If you are unsure as to where the "scripts" directory resides, open Gimp, select "Edit->Preferences" choose "Folders" in the scroll down menu on the left and click to expand it (there should be a small '+' or similar such marking which you can click), and then select the "Scripts" item. On the right you should be presented with a list of one or more places in which Gimp will look for Script-Fu scripts. You may choose to add an additional folder here if, for instance, the system you are using restricts your account from copying items into the folder(s) in which Gimp already looks for scripts.

    About the Update:

    This update restores the original "Cut" script, renames all three scripts, and moves them into a submenu off of the main "Script-Fu" menu. Upon working further with the script I realized that there were instances in which the original "cut" script is extremely useful.

    Common Problems:

    "Error: reverse: argument 1 must be: pair". If you see this message it means that you have neglected to link any layers. You must link layers together - to do so, in the Layers dialog, next to the "eye" that tells you whether or not a layer is visible is a blank space. Clicking this blank space will show "chain links". The script will technically work with only one layer "linked" though in that case it operates in essentially the same way that an ordinary cut or copy would.

    Scaling. Moving. Etc. If you experience any problems with scaling, moving, rotating, etc., undo the attempted action and ensure that you have one of the new temporary layers selected. If you are trying to scale to a larger size, note that the temporary layers are only created to the size of the selection. So while the scaling operation will appear normal, the results will be clipped to the size of the layer. To fix this, simply select each of the temporary layers (identifiable by the fact that they are the linked layers), and for each one, go to the menu and select "Layer->Layer to Image Size". Note also that while any transformations which show you a preview of their results (e.g. scale and rotate) will operate on all linked layers, only the layer that is selected will appear to be being transformed in the preview of the results. So you will need to choose which layer you want to see a preview for.

    Adding/Deleting Layers. Selecting "Merge Down Linked Layers (Paste)" without having done a corresponding "Cut" or "Copy". If you add a layer between a layer which was floated and the temporary layer that is created by "Cut" or "Copy", the subsequent "Paste" operating will paste the data into that newly added layer and not the original layer from which it came. If you have two layers linked and, without choosing "Cut" or "Copy", simply choose "Paste", the two layers will be combined into whichever layer exists below them. The bottom layer will remain unaffected. If more than two layers are linked, an error will occur if you try to paste in most cases. If there is at least one unlinked layer between each linked layer, no error will result and the contents of each of the linked layers will be merged down into the layer below it.
    License:
    GPLv2
    GIMP Version:
    2.6