Any way to resize all the layers in an xcf file to fit the canvas?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Any way to resize all the layers in an xcf file to fit the canvas?

Elle Stone
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.

Best,
Elle
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Carol Spears-2
On Sun, Mar 11, 2018 at 10:21 AM, Elle Stone <[hidden email]
> 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?
>
It is much much easier to resize the canvas to fit all of the layers.


>
> 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
friend....

carol
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Ofnuts-2
In reply to this post by Elle Stone
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.
>
> Best,
> Elle


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)

_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Ofnuts-2
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.
>>
>> Best,
>> Elle
>
>
> 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
https://sourceforge.net/projects/gimp-tools/files/scripts/

_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Elle Stone
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
> friend....

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
> https://sourceforge.net/projects/gimp-tools/files/scripts/

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.

Best,
Elle
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Joao S. O. Bueno Calligaris
In reply to this post by Ofnuts-2
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,

   js
  -><-

On 11 March 2018 at 18:41, Ofnuts <[hidden email]> 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.
>>>
>>> Best,
>>> Elle
>>
>>
>>
>> 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
> https://sourceforge.net/projects/gimp-tools/files/scripts/
>
>
> _______________________________________________
> gimp-user-list mailing list
> List address:    [hidden email]
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
> List archives:   https://mail.gnome.org/archives/gimp-user-list
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Carol Spears-2
In reply to this post by Elle Stone
On Mon, Mar 12, 2018 at 10:03 AM, Elle Stone <[hidden email]
> wrote:

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

Image --> Resize Canvas to Layers

carol
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Kevin Cozens-2
In reply to this post by Elle Stone
On 2018-03-12 10:03 AM, Elle Stone wrote:
>> See ofn-layers-to-image-size at
>> https://sourceforge.net/projects/gimp-tools/files/scripts/
[snip]
> 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.

That script could be worth including as part of what ships with GIMP.

--
Cheers!

Kevin.

http://www.ve3syb.ca/                | "Nerds make the shiny things that
https://www.patreon.html/KevinCozens | distract the mouth-breathers, and
                                      | that's why we're powerful"
Owner of Elecraft K2 #2172           |
#include <disclaimer/favourite>      |             --Chris Hardwick
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Ofnuts-2
In reply to this post by Joao S. O. Bueno Calligaris
On 03/12/18 15:39, Joao S. O. Bueno wrote:

> 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,
>
>     js
>    -><-
Will ponder this and update the script :)
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Elle Stone
Hmm, in GIMP-2.9, in Preferences, under "Dialog Defaults", there is an
option to always resize all the layers to the canvas size.

Well, that would solve the problem of resizing the layers to fit the
canvas, at least if the canvas is larger than and includes all the
content of all the layers. But sometimes layers are offset from the
canvas, and have content outside the canvas.

_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list
Reply | Threaded
Open this post in threaded view
|

Re: Any way to resize all the layers in an xcf file to fit the canvas?

Ofnuts-2
On 03/13/18 12:46, Elle Stone wrote:
> Hmm, in GIMP-2.9, in Preferences, under "Dialog Defaults", there is an
> option to always resize all the layers to the canvas size.
>
> Well, that would solve the problem of resizing the layers to fit the
> canvas, at least if the canvas is larger than and includes all the
> content of all the layers. But sometimes layers are offset from the
> canvas, and have content outside the canvas.

As far as I can tell, this is just a default used when you start
Image>Canvas size. So, nothing really changed since 2.8.
_______________________________________________
gimp-user-list mailing list
List address:    [hidden email]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list