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 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?


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:

  1. 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.
  2. 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.

Source : Link , Question Author : Frigo , Answer Author : lcnittl

Leave a Comment