Mobile app version of vmapp.org
Login or Join
Caterina889

: With GIMP, how to crop a layer to the size of a different layer? I have multiple layers in my project. I need to crop one (call it layer A) to the size of another (layer B). Neither has

@Caterina889

Posted in: #Crop #Gimp #Layers

I have multiple layers in my project. I need to crop one (call it layer A) to the size of another (layer B). Neither has the full size of the image.
I thought I would switch to B, Select All, switch to A and Crop to Selection. However, when I switch to layer A, the selection changes to match all of layer A so that Crop to Selection does nothing. What am I missing?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Caterina889

3 Comments

Sorted by latest first Latest Oldest Best

 

@Lee3735518

Both methods allow to crop a layer to the size of another even if they do not overlap. If they do, just skip the move steps.

If the first layer is an opaque rectangle:


Activate first layer (layer B) and Layer>Transparency>Alpha to selection. This creates a selection that exactly matches the layer.
If necessary:


Start the Move tool, and set it to Move selection (red square icon on the Move: line in the Tool options dialog
Use the Move tool to move the selection mask (ie, the "marching ants") and position it above the second layer.

Activate the second layer (Layer A) and Layer>Crop to selection


Another method (which will work even if the first layer isn't fully opaque):


Duplicate layer B
If necessary:


Position the layer B copy above layer A with the Move tool

If not fully opaque, bucket-fill with anything
Layer>Transparency>Alpha to selection
Delete the layer B copy
Activate the second layer (Layer A) and Layer>Crop to selection

10% popularity Vote Up Vote Down


 

@LarsenBagley460

I did it this way:


Select the layer in question (dotted frame appears)
Use 'select' tool, select an area just inside the layer edge
Zoom in to 800%
Manually expand the selection to pixel-match the layer
Crop to selection

10% popularity Vote Up Vote Down


 

@Kimberly620

It seems that there is no native way to do this, as the "Select All" feature makes a selection over the whole image area, resulting in an layer sized selection whenever you change the active layer.

Anyway, there are some possible ways:


Workaround: If the layers does not contain transparency you can right-click on the layer in the layers dialog ([Ctrl + L]), and press 'Alpha to Selection' - On changing the active layer, the selection remains the same.
Make it native with a plugin: If there is transparency a plugin does the job. I found 2 different plugins from Pedro Gimeno Fortea and Kevin Brubeck Unhammer (I only tested the one from Kevin Brubeck Unhammer beacause it seems to be newer (2012)). To install it, put the *.scm file in your gimp scripts folder (%APPDATA%/.gimp-[versionnumber]/scripts), and restart gimp. Now there should be a button Select > Layer to selection (The one on the very bottom) which produces a selection from the layer area - On changing the active layer, the selection remains the same.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme