0

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 '21 at 10:53
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 '21 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 '21 at 7:28
  • @Binarus - yeah, there are many ways.
    – Billy Kerr
    Dec 7 '21 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 '21 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 '21 at 10:23
  • I see. Finally understood - thanks again!
    – Binarus
    Dec 7 '21 at 10:37
1

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 '21 at 10:14
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 '21 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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