Hello, I'm trying out an Inkscape extension. The first attempt was to use a list from the layer_names.txt file to clip an image layer by layer and then export it, But I don't know how to proceed with the export. If I do it manually in Inkscape, it works as intended (the respective layer and clipping of the image). But my extension doesn't create the layer with the clipping... it always generates/exports the image that I actually only want to have the clipping with.
Hello, I'm trying out an Inkscape extension. The first attempt was to use a list from the layer_names.txt file to clip an image layer by layer and then export it, But I don't know how to proceed with the export. If I do it manually in Inkscape, it works as intended (the respective layer and clipping of the image). But my extension doesn't create the layer with the clipping... it always generates/exports the image that I actually only want to have the clipping with.
Inkscape: v 1.4
Source: Extension
Artwork: SVG file
thx a lot.
Found a mistake. I do in multiple actions, I have to do in one big action:
Action_Clip = (
f"select-clear;"
f"select-by-id:{layer_id};"
f"select-by-id:{clip_image_id};"
"object-set-clip"
)
Action_Export = (
f"select-clear;select-by-id:{layer_id};"
"export-type:png;"
"export-area-drawing;"
f"export-filename:{output_file};"
"export-do"
)
Action_Release_Clip = (
f"select-clear;select-by-id:{clip_image_id};"
"object-release-clip"
)
# Final
actions = f"{Action_Clip};{Action_Export};{Action_Release_Clip}"
subprocess.run(["inkscape", f"{self.input_file}", "--actions", f"{actions}"], check=True, stderr=subprocess.PIPE)
I just fail now on the
"export-area-drawing".
thx a lot.