Re: [Gimp-user] Any way to resize all the layers in an xcf file to fit the canvas?

Hi  -your scritp does not seem to account for layer groups (as in,
layers inside groups won't be resized).

If they are, it is because layer.resize_to_image_size() in a group
also resizes its contents - and it works,
but it means that invisible layers inside visible groups will be
affected as well.

best regards,


On 11 March 2018 at 18:41, Ofnuts <ofnuts gmx com> wrote:
On 03/11/18 21:57, Ofnuts wrote:

On 03/11/18 15:21, Elle Stone wrote:

Hi All,

Of course all the layers can be resized one by one to fit the canvas. But
I've been doing a *lot* of rearranging/moving of different groups of layers,
and clicking on each layer one by one to resize it is rather time-consuming
and involves a lot of clicking. Right now that's 17 layers and four groups.

Is there a magic command, or maybe an easy script that can be run to
resize all the layers to fit the canvas, all at once?

Also, does the layer mask resize when the layer is resized?

In case it matters, I'm using GIMP 2.9.8 on Linux.


My trick for this (on 2.8):

- Image>Canvas size and add 1 px, and select "resize all layers"

- Image>Canvas size and remove 1 px, and select "resize all layers"

Otherwise, in the python console:

    image=image=gimp.image_list()[0] # or other ways to obtain image

    for layer in image.layers: layer.resize_to_image_size()

(strike [enter] twice)

Since I have sen this question asked many times, I made a short script out
of it:

See ofn-layers-to-image-size at

gimp-user-list mailing list
List address:    gimp-user-list gnome org
List membership:
List archives:

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]