RSS/Atom feed Twitter
Site is read-only, email is disabled

Fit Canvas to Path

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

Fit Canvas to Path akovia 06 Nov 19:58
  Fit Canvas to Path Ofnuts 06 Nov 23:31
   Fit Canvas to Path akovia 07 Nov 11:40
    Fit Canvas to Path Ofnuts 07 Nov 14:26
     Fit Canvas to Path akovia 08 Nov 03:24
      Fit Canvas to Path Bertrand Denoix 08 Nov 13:31
       Fit Canvas to Path akovia 08 Nov 14:11
        Fit Canvas to Path Ofnuts 08 Nov 14:16
akovia
2015-11-06 19:58:25 UTC (about 9 years ago)

Fit Canvas to Path

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

-- akovia

Ofnuts
2015-11-06 23:31:00 UTC (about 9 years ago)

Fit Canvas to Path

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

-- akovia

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.

akovia
2015-11-07 11:40:10 UTC (about 9 years ago)

Fit Canvas to Path

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

-- akovia

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

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.

akovia
Ofnuts
2015-11-07 14:26:33 UTC (about 9 years ago)

Fit Canvas to Path

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

-- akovia

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.

akovia
2015-11-08 03:24:47 UTC (about 9 years ago)

Fit Canvas to Path

On Sat, Nov 7, 2015, at 09:26 AM, Ofnuts wrote:

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

-- akovia

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

!!!
Just tried this now and already can't live without it. You have my utmost thanks. Truly!

I saw you already added the margin option as well which is extremely useful for me.
If I could make one suggestion, it would be to duplicate or replace the menu items to the vector menu as that's where I would use it from as I want to select which path to set it to.

No worries if not as I can hack the script for my personal needs, but I think it would be better served in that menu.
Thanks for putting a smile on my face. After your first response I thought it was kinda hopeless.

Cheers!

akovia
Bertrand Denoix
2015-11-08 13:31:00 UTC (about 9 years ago)

Fit Canvas to Path

On 08/11/15 04:24, akovia wrote:

If I could make one suggestion, it would be to duplicate or replace the menu items to the vector menu as that's where I would use it from as I want to select which path to set it to.

No worries if not as I can hack the script for my personal needs, but I think it would be better served in that menu.

Using the Path menu was also my original version, but I reckoned that in most cases the active path would be the path to use anyway (and you can make any path the active one in the Paths list).

In any case, see version 0.2. Now you have the choice, you can set the default margin, and it deals better with an existing selection.

akovia
2015-11-08 14:11:53 UTC (about 9 years ago)

Fit Canvas to Path

On Sun, Nov 8, 2015, at 08:31 AM, Bertrand Denoix wrote:

On 08/11/15 04:24, akovia wrote:

If I could make one suggestion, it would be to duplicate or replace the menu items to the vector menu as that's where I would use it from as I want to select which path to set it to.

No worries if not as I can hack the script for my personal needs, but I think it would be better served in that menu.

Using the Path menu was also my original version, but I reckoned that in most cases the active path would be the path to use anyway (and you can make any path the active one in the Paths list).

In any case, see version 0.2. Now you have the choice, you can set the default margin, and it deals better with an existing selection. _______________________________________________ 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

Perfection!
Thank you so very much.

On a side note, The documentation has a small error I think. "The configuration file shall be named ofn-fit-canvas-to-path.ini and be located in the tool-settings subdirectory of your Gimp profile."

I checked your source and it should be tool-options subdirectory. Just wanted to give a heads-up.

akovia
Ofnuts
2015-11-08 14:16:26 UTC (about 9 years ago)

Fit Canvas to Path

On 08/11/15 15:11, akovia wrote:

On Sun, Nov 8, 2015, at 08:31 AM, Bertrand Denoix wrote:

On 08/11/15 04:24, akovia wrote:

If I could make one suggestion, it would be to duplicate or replace the menu items to the vector menu as that's where I would use it from as I want to select which path to set it to.

No worries if not as I can hack the script for my personal needs, but I think it would be better served in that menu.

Using the Path menu was also my original version, but I reckoned that in most cases the active path would be the path to use anyway (and you can make any path the active one in the Paths list).

In any case, see version 0.2. Now you have the choice, you can set the default margin, and it deals better with an existing selection. _______________________________________________ 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

Perfection!
Thank you so very much.

On a side note, The documentation has a small error I think. "The configuration file shall be named ofn-fit-canvas-to-path.ini and be located in the tool-settings subdirectory of your Gimp profile."

I checked your source and it should be tool-options subdirectory. Just wanted to give a heads-up.

Thx. Will fix.