On 07/11/15 12:40, akovia wrote:

On Fri, Nov 6, 2015, at 06:31 PM, Ofnuts wrote:
On 06/11/15 20:58, akovia wrote:
Would it be possible to script this in any way? Seems like it should be
a feature already as I keep looking for it but no matter how many times
I check, it never appears. :P

Stroke the path with a 1px brush and autocrop the image

Without stroking it could be slow because you have to follow the path
pixel by pixel and keep min/max coordinates. To do it a lot faster you
can instead keep the min/max coordinates of anchors and handles but if
this guarantees that you get a rectangle that contains the path, in the
general case it won't be the tightest fit.

Thanks for the reply Ofnuts,
What I was looking for was to expand the canvas to accommodate a path.
The inverse is easy as I just load path to selection and then crop to
selection. It has always seemed instantaneous to me.

I trace out elements in a picture and continue my path outside the
canvas to restore elements that were either cropped off or were never
there. I end up with a path that goes beyond the bounds of the canvas
and have to just take a stab of how big to enlarge the canvas to make it
fit. I usually just go overboard and use the technique I described
above, but I do it enough that a function to expand/fit canvas to path
would be extremely helpful. I'm guessing this just isn't possible with a
script/plugin at this point.

OK, see ofn-fit-canvas-to-path on https://sourceforge.net/projects/gimp-path-tools/files/scripts/

Actually a mix of Bodo's ideas and mine. First compute a rough bounding box using path coordinates, resize the canvas to this, then crop using a selection on the path for a tighter fit.

If you want to be able to add a margin just ask.

gimp-user-list mailing list
List address:    gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list

Reply via email to