Post Reply 

Cropping an image to one layer's boundaries

Jun 24, 2014, 04:51
Post: #1
Cropping an image to one layer's boundaries
Hello,

Suppose I have several layers of different sizes and I want to crop/trim the whole image to the size of the smallest one. So I pick one layer, Select > All (yellow/black border delimiting the layer turns to black/white "marching ants", grey/white borders surround the layer and the whole image), Image > Crop to Selection. Nothing happens. The layers and the image W×H as shown in the title bar stay the same.

Now, a selection from any tool (rectangle, text > path > selection, etc.) works as I expect it to. How are these types of selections different? Once again I'm at my wits' end.

(GIMP 2.8.10)
Find all posts by this user
Quote this message in a reply
Jun 24, 2014, 05:13 (This post was last modified: Jun 24, 2014 05:28 by fluffybunny2.)
Post: #2
RE: Cropping an image to one layer's boundaries
(Jun 24, 2014 04:51)arielCo Wrote:  Hello,

Suppose I have several layers of different sizes and I want to crop/trim the whole image to the size of the smallest one. So I pick one layer, Select > All (yellow/black border delimiting the layer turns to black/white "marching ants", grey/white borders surround the layer and the whole image), Image > Crop to Selection. Nothing happens. The layers and the image W×H as shown in the title bar stay the same.
Use the Crop tool. In the tool's options, make sure 'Current Layer Only' is unchecked.
   
Find all posts by this user
Quote this message in a reply
Jun 24, 2014, 05:27
Post: #3
RE: Cropping an image to one layer's boundaries
(Jun 24, 2014 05:13)fluffybunny2 Wrote:  In the Crop tool's Tools Options, make sure 'Current Layer Only' is unchecked.

It is unchecked (how am I supposed to know to look there?).

Screenshot, after pressing Control-A with the top, smaller layer active:

[Image: gE2xdPd.png]
Find all posts by this user
Quote this message in a reply
Jun 24, 2014, 06:51
Post: #4
RE: Cropping an image to one layer's boundaries
To crop the image around a given layer, if the layer is fully opaque:

- Layer>Transparency>Alpha to selection this will create a selection the size of the layer
- Image>Crop to selection

(if the layer isn't fully opaque, the outer transparent bits will be cropped too, as if Layer>Autocrop layer was used).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 24, 2014, 12:35 (This post was last modified: Jun 24, 2014 12:36 by arielCo.)
Post: #5
RE: Cropping an image to one layer's boundaries
Thanks for the idea, and your time.

So, the way I see it,
  • There's no way to use the layer boundary for this purpose,
    and more importantly
  • Even though I used a command called "Select All" and I'm seeing a marquee identical to a Selection, it doesn't behave entirely like one. That made me run in circles for a while.

Do you think it could be reasonably called a bug? I think the best solution would be that Gimp did treated the result of Select > All as a Selection.
Find all posts by this user
Quote this message in a reply
Jun 24, 2014, 13:51
Post: #6
RE: Cropping an image to one layer's boundaries
It's not a bug, it's how the selection works. The selection is not linked to a specific layer, it is linked to the canvas. The pixels that can be changed are the pixels in the current layer that are also in the selection; in other words, those that inside the moving dotted line of the selection(*).

What you want is a different operation: Layer boundary to selection (or selection from layer boundary).

But we overlooked a very simple method:
- remove the selection Select>None
- make active the layer you want crop the image around
- shift-click on the eye icon of that layer in the Layers list: this will make all other layers invisible
- Image/Autocrop image
- Restore the visibility of other layers if needed.

(*) the part of the selection that is outside the active layer is shown with a fixed dotted line...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 29, 2014, 06:40
Post: #7
RE: Cropping an image to one layer's boundaries
(Sorry for taking so long to follow up - I had trouble capturing the screen to GIF)

(Jun 24, 2014 13:51)ofnuts Wrote:  It's not a bug, it's how the selection works. The selection is not linked to a specific layer, it is linked to the canvas. The pixels that can be changed are the pixels in the current layer that are also in the selection; in other words, those that inside the moving dotted line of the selection(*).

Are you sure that only "the current layer" is affected? When I crop with a handmade selection (rectangle/lasso/etc), it affects all the layers:

[Image: Oiz4pdl.gif]

(Jun 24, 2014 13:51)ofnuts Wrote:  What you want is a different operation: Layer boundary to selection (or selection from layer boundary).

But we overlooked a very simple method:
- remove the selection Select>None
- make active the layer you want crop the image around
- shift-click on the eye icon of that layer in the Layers list: this will make all other layers invisible
- Image/Autocrop image
- Restore the visibility of other layers if needed.

(*) the part of the selection that is outside the active layer is shown with a fixed dotted line...

Now this method uses the current layer, regardless of which are visible:

[Image: ESTfcTZ.gif]
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How to add a magnification segment of an image to the original size image fenpeppertree 1 80 Nov 7, 2017 17:05
Last Post: paynekj
  removing unwanted portions of selected area in an image pizzipie 1 91 Nov 2, 2017 05:31
Last Post: paynekj
  Recolor image and maintain detail awesley 1 110 Oct 29, 2017 16:48
Last Post: paynekj
  XCF Thumbnail/Preview Image DailyLunatic 6 3,908 Oct 23, 2017 11:46
Last Post: paynekj
  Image centering for printing okfhp 1 317 Aug 23, 2017 17:51
Last Post: ofnuts

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS