Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cropping and slicing a path
#16
(03-30-2021, 01:38 PM)Ottia Tuota Wrote: I added a new path-cropping plugin: Crop a path by a general selection. The new version is 0.6 and it is in the same place as before:

http://kmarkku.arkku.net/Path_crop_files...aster.html

It seems to work correctly though it is slow. Please report any erronous behaviour.

As an example I use the Truchet path. Here I have drawn an additional path (red) from which to make a selection.



I did:
  1. Path to selection from the red path.
  2. Call the new plugin "crop path by general selection" (choosing the inside-outside option to be "both").
I got two paths. Here I display them separately. The red path does not belong to the cropped paths.





The input "Threshold" is meaningful if your selection is feathered.

In complicated cases the plugin is slow (the above run takes some 31 seconds), which is mainly due to the large number of calls to image.selection.get_pixel(). There may be some way to restrict that number of calls, but that would require further complication of the code. And it may not be so efficient after all. Currently I am not willing to try it. Going now to another project. Happy for having finished this. Please have fun.

There is a much more efficient way than get_pixel(). You can use a pixel_region, which ends up as an array directly usable in Python. Some exemple [here](https://www.gimp-forum.net/Thread-Gimp-python-and-numpy) (before the conversion to a numpy array of course).
Reply


Messages In This Thread
Cropping and slicing a path - by Ottia Tuota - 10-09-2020, 11:31 AM
RE: Cropping and slicing a path - by Ofnuts - 10-09-2020, 08:09 PM
RE: Cropping and slicing a path - by Ottia Tuota - 10-09-2020, 08:55 PM
RE: Cropping and slicing a path - by Krikor - 10-09-2020, 10:51 PM
RE: Cropping and slicing a path - by Ottia Tuota - 10-10-2020, 04:27 AM
RE: Cropping and slicing a path - by Ottia Tuota - 01-01-2021, 11:08 AM
RE: Cropping and slicing a path - by Ottia Tuota - 01-17-2021, 04:08 PM
RE: Cropping and slicing a path - by denzjos - 01-19-2021, 08:51 AM
RE: Cropping and slicing a path - by Krikor - 01-19-2021, 01:22 PM
RE: Cropping and slicing a path - by Ottia Tuota - 01-19-2021, 02:08 PM
RE: Cropping and slicing a path - by Krikor - 01-19-2021, 02:37 PM
RE: Cropping and slicing a path - by Ottia Tuota - 01-21-2021, 12:30 PM
RE: Cropping and slicing a path - by Krikor - 01-21-2021, 04:10 PM
RE: Cropping and slicing a path - by denzjos - 01-21-2021, 02:30 PM
RE: Cropping and slicing a path - by Ottia Tuota - 03-30-2021, 01:38 PM
RE: Cropping and slicing a path - by Ofnuts - 03-30-2021, 03:07 PM
RE: Cropping and slicing a path - by Ottia Tuota - 03-30-2021, 04:49 PM
RE: Cropping and slicing a path - by Krikor - 03-30-2021, 06:45 PM
RE: Cropping and slicing a path - by Ottia Tuota - 03-30-2021, 08:32 PM
RE: Cropping and slicing a path - by Krikor - 03-30-2021, 09:34 PM
RE: Cropping and slicing a path - by Ottia Tuota - 03-31-2021, 07:03 AM
RE: Cropping and slicing a path - by Ottia Tuota - 03-31-2021, 12:28 PM
RE: Cropping and slicing a path - by denzjos - 03-31-2021, 03:27 PM
RE: Cropping and slicing a path - by Ofnuts - 03-31-2021, 04:00 PM
RE: Cropping and slicing a path - by denzjos - 03-31-2021, 04:16 PM
RE: Cropping and slicing a path - by Krikor - 03-31-2021, 05:41 PM
RE: Cropping and slicing a path - by Krikor - 04-01-2021, 12:33 AM
RE: Cropping and slicing a path - by Ottia Tuota - 04-01-2021, 06:23 AM
RE: Cropping and slicing a path - by Krikor - 04-01-2021, 08:47 AM
RE: Cropping and slicing a path - by Ofnuts - 04-01-2021, 11:54 AM

Forum Jump: