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

On 03/11/2018 12:06 PM, Carol Spears wrote:
It is much much easier to resize the canvas to fit all of the layers.

All the layers are different sizes, so I don't think this would work, would it? Unless you mean what Ofnuts described, resizing by a pixel, and then resizing again to return to the original canvas size. I never would have thought of that trick.

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

I just tried this and it does.  You can try this also, Edit -->Undo is a

Thanks! for checking. Actually I did try, but I couldn't tell what was happening. I should have spent more time experimenting to determine what was really happening.

On 03/11/2018 05:41 PM, Ofnuts wrote:

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

Hi Ofnuts,

Thanks much! for the trick and the script. Hopefully I won't be resizing this particular image any further, but the next time I resize an image I'll figure out how to use the script, or at least will use the trick.


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