Gimp-Forum.net
Path generation with scripts - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Path generation with scripts (/Thread-Path-generation-with-scripts)



Path generation with scripts - GimpNewbWithQuestions - 01-20-2020

I have a rather specific and esoteric problem, or at least I think so.

Ultimately, I want to generate a path from a set of points/vectors/contours via a gimp script. This path should then be copied onto a jpg (the original source of the points/curves/contours). The resulting image has to have the path we created visible and editable in Photoshop.

All of this happens inside a Linux server; I work in Java mostly. To be clear, this has to work via CLI.

My questions are:
1) Is this possible at all?
2) What do the parameters need to look like if it is?

What I found in my quest to solve this problem is the 8BIM path specification from adobe, but that's about all I have right now

I would be very grateful if someone can give me some pointers in the right direction


RE: Path generation with scripts - Ofnuts - 01-20-2020

Yes, you can generate a path with scripts in Gimp, I have a whole library of scripts that do just that.

However, Gimp will not save any path as the Adobe clipping path in a JPEG (AFAIK this is a proprietary extension to the standard), so once you have a path in Gimp you are a bit stuck.

You would have to find some utility that knows how to add such a path in a JPEG.

If the path can be created without any human intervention,  you don't really need Gimp, there are libraries out there that can handle Bezier curves.

If there is some human intervention and you need to use Gimp, you can create your own file export plugin, that would use the built-in jpeg export to create the JPEG and then call the aforementioned utility to insert a path in the JPEG


RE: Path generation with scripts - rich2005 - 01-20-2020

A possible workaround.

A Gimp tiff with a path, converts to a jpeg with clipping path using ImageMagick (IM), As:

Code:
magick image-in.tiff -clip image-out.jpg

That is IM7 -  IM6 uses convert = magick

Nothing PS to demo on at the moment, but this using jpeg (in the inset)  and scribus. 

[attachment=3826]

If you can avoid the necessity for a jpeg, the Gimp tiff shows in PS with the path.
Edit Possibly the Ofnuts plugin to start with path-csv-0.1.py


RE: Path generation with scripts - GimpNewbWithQuestions - 01-21-2020

Quote:However, Gimp will not save any path as the Adobe clipping path in a JPEG (AFAIK this is a proprietary extension to the standard)

Yeah, I was afraid of that.

Quote:If the path can be created without any human intervention, you don't really need Gimp, there are libraries out there that can handle Bezier curves.

This is a very good point, thank you!

Quote:A Gimp tiff with a path, converts to a jpeg with clipping path using ImageMagick (IM)

I need to test this, it would be great to have at least a working solution, even if it uses workarounds

Thanks for the help so far! This is more progress than I had hoped for Smile