It is currently Thu Nov 12, 2026 7:06 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 12:15 pm  (#1) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
GIMP Version: 2.6.11
Operating System: Linux
OS Version: Fedora 12
GIMP Experience: Intermediate Level



Is there a menu item I have missed that does this?

I want to position and size the boundary around a small image with a transparent background that overlays a filled background then crop the whole image to the layer boundary size.

I have figured out a somewhat klunky way to do it:

  1. Autocrop the layer of the small image and move it to where I want it to be on the background.
  2. Enlarge the Layer boundary to the size I want.
  3. Duplicate the small image with the desired layer boundary size and delete the image on that layer.
  4. Click inside the layer boundary with the fuzzy select tool, invert.
  5. Click the background layer and delete.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 12:35 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12856
There is a layer to boundary size (right-click on layer) option but it doesn't work. I usually have to autocrop O. Now if the size of the paste is bigger then your canvas size, you have can do a layer to boundary size to see the dimensions and then resize the overall canvas (i.e., even more clunky; lol). I have to do this more often then I wan to as well so I do sympathize with you. :)


Attachments:
lb.png
lb.png [ 282.76 KiB | Viewed 9083 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 1:27 pm  (#3) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
Well I should have played with this longer. Found a quicker way.

Autocrop the layer the small image is on, resize the boundary centering the picture in it.

Position the small image over the background where you want it.

Duplicate the small image layer. With that layer selected, delete the image in it.

Use that for autocropping the image. Voila! It deletes to the layer boundary and the small image is where you want it on the background.

It doesn't work if the small image is on the layer - autocrop deletes to the size of the small image.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 1:44 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12856
Yup; lol

Still wonder why they even have the layer to boundary size option when it don't work. It is useful when the layer size is bigger then the canvas size since it will give you the size of the layer so you can then increase the size of the canvas as needed. Anyway, Autocrop rules; zealous crop is too slow and only seldomly use it now. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 2:48 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
duplicate post, don't know how that happened.

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Last edited by Gms9810 on Mon Apr 11, 2011 10:36 pm, edited 1 time in total.

Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 2:51 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
lylejk wrote:
There is a layer to boundary size (right-click on layer) option but it doesn't work...

It doesn't work? And all this time I've been beating myself up for thinking that it doesn't do much. Now I don't know whether to be relieved that it doesn't do anything or feel like a dope because i never noticed it.

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Mon Apr 11, 2011 7:26 pm  (#7) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6946
Location: Somewhere in GIMP
Perhaps this will show more clearly what I was doing. This isn't the image I was working on but the stripes show better what I was doing.

This is a screen shot of the image before cropping with an inset of the layers. The top layer is transparent but still has the layer boundary in it.

Image

This is the final image. The top layer was still selected and Image > Autocrop.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Tue Apr 12, 2011 1:35 am  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
lylejk wrote:
There is a layer to boundary size (right-click on layer) option but it doesn't work.

What does this mean ("doesn't work")? It resizes the layer to the dimensions and offsets specified. What else should it be doing?

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 6:29 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Well, I came across a rather unique style of use for layer boundaries - in composite templates. I've used these sort of templates in Paint Shop Pro without ever having made any myself, but now seeing their construction firsthand and being enlightened, I find this to be a very good way to make scrapbook pages.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 7:27 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12856
saulgoode wrote:
lylejk wrote:
There is a layer to boundary size (right-click on layer) option but it doesn't work.

What does this mean ("doesn't work")? It resizes the layer to the dimensions and offsets specified. What else should it be doing?


If you paste a layer that has bigger dimensions then your working layer, when you choose layer to boundary size, it shows the size of the bigger layer but it does not size up the working layer to those dimensions. I do, however use the information from layer to boundary size to increase the canvas size as needed when I do have to, but it would be cool if layer to boundary size would do this for me. That is what I'm talking about Saul. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 11:34 am  (#11) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
@lylejk... I'm confused by what you're saying. If I select Layer Boundary Size on any layer, the width and height values are the boundary of that layer and the dialog is prompting you to change them. If I understand you correctly you are saying that you are getting the Set Layer Boundary Size dialog to display the width and height of a different layer to the one you have right-clicked on?

Is the larger layer you are pasting in bigger than the current canvas size? because if it is then don't you have to use Image>Fit Canvas to Layers?

Kevin


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 2:22 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
That's not what it's suppose to do, Lyle. It creates a boundary (hides everything beyond the boundary) for the layer you select it for. If you need your boundary layer to exceed your working layer (background image) you'll need to increase the size of the canvas in order to see it. That's what Saul and I have pointed out. So, it does work. Just not the way you expect it to.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 4:46 pm  (#13) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
@Oregonian, would not the following steps accomplish what you need?
  • Position your small layer appropriately over the background.
  • Make a rectangular selection bounding the area of the desired final canvas.
  • With your small layer still active, create a new, transparent layer (this transparent layer will be the same size as the canvas).
  • Layer->Merge Down (your small layer will now extend to the boundaries of the selection).
  • Image->Crop to Selection.

@Lylejk, after you perform an Edit->Paste, the "floating selection (pasted layer)" will have the same dimensions as whatever was in the clipboard, and the marching ants will indicate this boundary. Only the portion of the "floating selection (pasted layer)" which covers the original layer will be shown (the 'original layer' being the one that was active when the paste was performed). This behavior will be more apparent if you were to move or transform the floating selection (scale, rotate, sheer, etc).

If, at this point, you perform a "Layer->Layer Boundary Size..." then you are changing the boundary of the floating selection (just as its boundary might be changed by a transform or move). This may or may not have an effect depending upon what you do next.

If you anchor the floating selection, it will be merged with the original layer; cropped to the boundaries of the original layer. In this scenario, any increase of the boundary size that was performed on the floating selection will have no effect (which I presme was your point), and a decrease would only be noticeable if the floating selection has been resized to be less than the boundaries of the original layer (this would have been noticeable right after performing the resize, before anchoring).

If, instead of anchoring, you had created a new layer from the floating selection then the dimensions of that new layer will be the same as the floating selection's after whatever modifications (moving, transforming, resizing) have been performed.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Wed Apr 13, 2011 5:23 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12856
Yeah; figured is what my minds eye was interpreting what the function should be and what is meant by the function. It's still cool to be able to see what the pasted layer size is so I can do a resize of canvas when I need to though so it's not a complete useless feature, but based on my gonzo editing technique, I've yet really needed to use this feature. lol

Thanks for the clarification Saul/Mahvin. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Image to Layer Boundary Size
PostPosted: Thu Apr 14, 2011 1:42 pm  (#15) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
lylejk-

Here is a (trivial) script that does what I think you were expecting, and actually doesn't seem to have a simple menu based equivalent.

It will resize/reposition the image canvas to that of the active layer. No cropping, and none of the other layers are altered in any way.

It shows up in both the Image menu and the Layer (right-click) menu.

-Rob A>

; fit_canvas_to_layer.scm
; by Rob Antonishen
; http://silent9.com

; Version 1.0 (20110414)

; Changes:

; License:
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; The GNU Public License is available at
; http://www.gnu.org/copyleft/gpl.html

(define (script_fu_canvas_to_layer img inLayer)

(let*
    (
    (width (car (gimp-drawable-width inLayer)))
    (height (car (gimp-drawable-height inLayer)))
    (offx (* -1 (car (gimp-drawable-offsets inLayer))))
    (offy (* -1 (cadr (gimp-drawable-offsets inLayer))))
)
    ;  it begins here
    (gimp-context-push)
    (gimp-image-undo-group-start img)

    (gimp-image-resize img width height offx offy)
   
    (gimp-image-undo-group-end img)
    (gimp-displays-flush)
    (gimp-context-pop)
)
)

(script-fu-register "script_fu_canvas_to_layer"
                    "Fit Canvas to Active Layer"
                    "Resize Canvas (without cropping) to active layer."
                    "Rob Antonishen"
                    "Rob Antonishen"
                    "April 2011"
                    "*"
                    SF-IMAGE      "image"      0
                    SF-DRAWABLE   "drawable"   0                       
)

(script-fu-menu-register "script_fu_canvas_to_layer"
                    "<Layers>")

(script-fu-menu-register "script_fu_canvas_to_layer"
                    "<Image>/Image")

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group