Automatically trimming "down" the background layer based on the upper layer sizes

Here everybody can post his problems with PhotoLine
cadudesun
Mitglied
Posts: 19
Joined: Tue 14 Dec 2021 15:36

Automatically trimming "down" the background layer based on the upper layer sizes

Post by cadudesun »

Hi. I'd appreciate your help.

As shown in the screen-recording (https://tinyurl.com/y27276nn), by using the command "Layout>Document>Trim Document", I can "increase" the background layer size automatically, according to the size of the upper layers.
Once the background layer size is increased, the command "Trim Document" doesn't work anymore when the area of the upper layers is "smaller" than the background layer.
I could use the "crop" tool to trim the background layer based on the upper layer sizes, but it is a process with a couple of steps, involving manually drawing an area firstly.
I'm wondering whether there is a command to automatically trim down the background layer based on the upper layer sizes, similarly to the "trim document" command (one-click command).

Thank you,
Cadu
User avatar
russellcottrell
Mitglied
Posts: 192
Joined: Sat 26 Jul 2014 10:13

Re: Automatically trimming "down" the background layer based on the upper layer sizes

Post by russellcottrell »

Another way, which may not be that much easier manually but would allow scripting, is to select the layer whose size the image is to be trimmed to, then use Layout - Document - Change Document Size; use the layer’s dimensions as the new document size, and the negative of the layer’s position as the new document position. When I do it, the position of the new image in the dialog display is incorrect for some reason, but the final result is correct.
User avatar
shijan
Mitglied
Posts: 1058
Joined: Mon 23 Dec 2019 15:21
Location: Ukraine

Re: Automatically trimming "down" the background layer based on the upper layer sizes

Post by shijan »

In PhotoLine there is a "Picture Mode" and "Document Mode".
In "Picture Mode" The Background is your base. It defines borders of your image. So you can't trim less that newly generated larger sized background. In "Picture Mode" if you drag smaller layer to the bottom - it became your new background and will change image size. If you crop document "Picture Mode" - cropped pixels are gone forever.
"Picture Mode" may be considered as "basic" or "simple" mode. It is ok when you have image and some filters. But if you do some complex work, you need switch to "Document Mode"

"Document Mode" is sort of "unlimited mode" or "advanced" mode. It is like empty container. It allow any image manipulations, it will not crop pixels of the image when you crop document. It allow more advanced non destructive color management manipulations and many more other useful options.

So in your situation in "Picture mode" "Trim Document" command generates new background fill and can't opposite way because "Transparency" is disabled in Background layer attributes.
Image

:arrow: In summary: Use transparent Background image in "Picture Mode". Or better switch to "Document Mode" and set any virtual color for background there in Document Attributes panel. So your background will remains white and will not affect real images during Trim. I really suggest do any more-less complex work only in "Document Mode"

Image
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302
Martin Huber
Entwickler
Entwickler
Posts: 3929
Joined: Tue 19 Nov 2002 15:49

Re: Automatically trimming "down" the background layer based on the upper layer sizes

Post by Martin Huber »

"Trim Document" resizes the document (and in Picture Mode the background layer) to fit the size of the visible content of the document.

Just as shijan said: If the background layer doesn't have transparency, the resulting size will never be smaller.

In this case, you can use a trick: Turn off the visibility of the background layer, trim the document and turn it on again.

And if you don't really need a background layer, use the Document Mode.

Martin
cadudesun
Mitglied
Posts: 19
Joined: Tue 14 Dec 2021 15:36

Re: Automatically trimming "down" the background layer based on the upper layer sizes

Post by cadudesun »

Many thanks to all of you for the detailed explanations.
To toggle from picture to document mode (under Document Attributes panel) is so convenient!