4

This question may seem to be a duplicate of this one.

However, both of the solutions shown there can't be applied to my problem. They both seem to be valid for situations where you want to copy the selection shape within the same image, while I'd like to copy it from one image to multiple others (or, at least, one other). Furthermore, the second solution discourages applying the first one with a reasoning which makes sense in my eyes.

Has the situation changed in the meantime? Is there a reasonable way to copy the selection shape from one image to another? If it matters, I would need that only for rectangle selections.

1
  • Welcome to GD.SE!
    – Mensch
    Dec 6, 2021 at 10:53

5 Answers 5

3

For an arbitrary shape:

  • Make your selection in the first image
  • Enter "Quickmask" mode by clicking the square icon at the bottom left corner of the image.
  • Edit > Copy or Ctrl-C
  • Exit Quickmask (click same icon)
  • Move to the other image
  • Enter QuickMask as above
  • Ctrl-V, Ctrl-H to paste
  • Exit Quickmask
1
  • Wow. Thank you very much. This is easy and comfortable. Thanks for sharing, and +1.
    – Binarus
    Dec 7, 2021 at 10:14
1

Not sure if I fully understood your question, so this is a bit of a guess. Might help if you were to show an example of what you are actually trying to do.

Anyway it seems like you want to store a selection, and use it in one or more multiple images. There are many ways this could be done, and it would really depend on the situation. Anyway, here's one method that isn't mentioned in the other question.

  1. Make a selection
  2. Create a new transparent layer
  3. Do Edit > Fill with FG/BG colour. Any colour will do.
  4. Do Select > None

You can now use this layer as an image to store your selection. You can hide it if you don't want to see the layer. You can Select All, Copy it, and Paste As New Layer to another image. To get the selection back, right click the layer and choose Alpha to Selection. This will reload the selection.

3
  • Thank you very much, accepted and +1. I can confirm that your method works. Compared to making the selection from scratch in each image, it is easier and faster, but not as much as we were hoping :-) In the meantime, we have been shown an alternative method which is even faster; see my own answer.
    – Binarus
    Dec 7, 2021 at 7:15
  • Instead of Copy/Paste you can just drag from the Layers list of he first image to the canvas of the target.
    – xenoid
    Dec 7, 2021 at 7:28
  • @Binarus - yeah, there are many ways.
    – Billy Kerr
    Dec 7, 2021 at 10:51
1

To copy rectangle selections, a very fast method:

  1. Make your selection
  2. Select > To path:
  3. Open the Paths list dialog: this created a path named "Selection" (if you need to do this for several selections, you can rename it at this point)
  4. Drag the path from the Path list to the canvas of the target
  5. This creates a path called "Selection copy" in the target, and makes the target image active. Since the contents of the Path list dialog follow the active image, the "Selection copy" appears in the Paths list
  6. Right click on it, and Path to selection.

If you need to repeat on several images, you can reuse the path, so repeat from step #3.

Note: technically, this solution could work for any arbitrary shape, but in the general case, the path is an approximation of the selection, and the selection is an approximation of the path, so the selection in the target would be a double approximation of the selection in the source. However, for rectangular selections/paths, there is no approximation so the copy is accurate.

3
  • Thank you very much, +1. This works as well, and in some quick tests with rectangle selections, there was no loss of precision. However, one of the answers in the question I linked in my original post discourages using paths for this purpose because this may produce inaccurate results. I am feeling a bit unsure about that ...
    – Binarus
    Dec 7, 2021 at 10:21
  • 1
    See the end note. This is true in the general case, but a rectangle selection produces a 4-points path, which itself produces a perfect rectangle selection.
    – xenoid
    Dec 7, 2021 at 10:23
  • I see. Finally understood - thanks again!
    – Binarus
    Dec 7, 2021 at 10:37
0

The method in @Billy Kerr's answer is working, but I'd like to share an alternative method I have been shown in the meantime. The following solution has been posted by @Wormnest here.

Solution (literally cited from the link above):

  • Assuming the rectangle select tool is selected:
  • Check the box that says "Fixed", the default is usually Aspect Ratio; change it to "Size".
  • In the edit control directly below it write down the dimensions, e.g. 100x150 (with an x between them). As an aside, it would be nice if GIMP could prefill it with the current selection size.
  • If you want to save these dimensions you should save it as a preset. If you only need it while GIMP stays open then you can do:
  • Switch to another image.
  • Click where you want with the rectangle tool. It should have a fixed size selection.

I can confirm that this solution works, although it is very worrying that the selection in the first place does not change when you enter new dimensions in the "Size" field. But when you create a new selection, it has the dimensions expected.

The method is really fast once you have set the correct rectangle selection tool options: In each image, you just need to click and move the selection to the correct location. I hardly can imagine a faster method (well, when defining the initial selection, the "Size" field could be pre-filled with the values of the current selection :-)).

1
  • Even if Gimp stays up, you can't use the rectangle tool for another selection. See my solution above with a path. One of its side advantages is that the path says with the image (if saved as XCF) and not lost as an unrelated preset.
    – xenoid
    Dec 7, 2021 at 10:08
0

My own take on this one is to first create a new layer in the source image by floating the desired selection I want to duplicate from it. That's a little tricky in and of itself (you can punch holes in your source image if you're not careful, among other weirdnesses), for those who have never done it before, or are not used to it, so maybe dig into that end of things elsewhere to make sure you can get started by doing this initial float competently.

With both source and target images open in separate windows (and the one you're going to be dragging stuff into only has to be a small sliver, just big enough to drop something into) I drag the new layer from the source image by clicking on it in the LAYERS PANEL and dragging it into the target image, creating a duplicate new layer in the target image.

Then, in the Layers Panel of the target image, I right-click this new layer, and down at the bottom of the right-click options menu that comes up, I can hit "Alpha to Selection" and that creates a faithful outline selection of what I want, against my target image background which I want to move the selection area someplace into.

With the Move Tool invoked, I hold down CTRL-ALT, click down on the selected area in the target image (making sure that particular layer in the Layers Panel still has focus), watch as the Move Tool symbol changes, hold the click, drag, and let go of the moved selection outline wherever I want it.

And if I didn't get it exactly right, I can give the background of the target image focus in the Layers Panel, and do the CTRL-ALT Move Tool process again with a held-down click, and put it wherever I want it.

This also works after I've zoomed way in on the background image, to give me singl-pixel-resolution for precise placement of my selection area, and I can keep moving the selection area around till I'm happy with it.

Once all that is done, with the background of the target image still focused in the Layers Panel, I can then do an other float with this new selection area, and create a new Floated Layer with it, and work from there.

It seems clunky at first, but there's a kind of rhythm to it, and if done a few times in succession, muscle memory sets in and the work starts to flow, and all is well.

GIMP 2.10.30 running in Linux Mint Mate, with the Toobar and Dockable Dialog Windows all broken loose from the main GIMP window, and moved over to a second monitor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.