Cannot load .svg to label to images - 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) +--- Thread: Cannot load .svg to label to images (/Thread-Cannot-load-svg-to-label-to-images) |
Cannot load .svg to label to images - Someone - 12-26-2023 Hello, i am trying to add an .svg label to images using Python-fu, but getting an unhelpful error code when trying to load the .svg My console text: ➤> pdb.gimp_path_import(image, "label.svg", TRUE, FALSE) the error: Traceback (most recent call last): File "<input>", line 1, in <module> RuntimeError: execution error I am guessing this is a path problem. New to this stuff, any tips would be appreciated, thanks! RE: Cannot load .svg to label to images - rich2005 - 12-26-2023 Well, I am no expert either, best wait for Ofnuts to come along. In the meantime this works for me in linux - kubuntu 20.04 / Gimp 2.10.36 from PPA Code: ➤> image = gimp.image_list()[0] Trying to get everything into a single screenshot. Keeping it simple. 2.svg is a plain SVG from inkscape and is in my home folder. [attachment=10933] RE: Cannot load .svg to label to images - Ofnuts - 12-26-2023 (12-26-2023, 04:38 AM)Someone Wrote: Hello, i am trying to add an .svg label to images using Python-fu, but getting an unhelpful error code when trying to load the .svg "label.svg" doesn't tell where the file is, since there is no path component. So this is normally interpreted as "in the current working directory", which is, depending on how Gimp was started:
In practice, depending on source:
RE: Cannot load .svg to label to images - Someone - 12-28-2023 (12-26-2023, 09:52 AM)rich2005 Wrote: Well, I am no expert either, best wait for Ofnuts to come along. In the meantime this works for me in linux - kubuntu 20.04 / Gimp 2.10.36 from PPA Thanks for the reply. I am also using a simple inkscape svg. When i try to import a path (following your example), the error is slightly different GIMP 2.10.32 Python Console Python 2.7.18 (default, Oct 27 2021, 07:49:35) [GCC 11.2.0 64 bit (AMD64)] ➤> image = gimp.image_list()[0] ➤> pdb.gimp_vectors_import_from_file(image,"label.svg", False, False) Traceback (most recent call last): File "<input>", line 1, in <module> RuntimeError: No paths found in 'C:\Users\bhujl\label.svg' ➤> Really appreciate the feedback tho! (12-26-2023, 10:11 AM)Ofnuts Wrote:(12-26-2023, 04:38 AM)Someone Wrote: Hello, i am trying to add an .svg label to images using Python-fu, but getting an unhelpful error code when trying to load the .svg Thanks for the reply. Sorry, i should have mentioned that i figured out the working directory and already made sure the target file was located in that directory. I was more wondering if i had a single quote/double quote/leading slash type issue. Basically, i am trying to add a label to a batch of images. Is there a workaround? It doesn't have to be an svg, i could transform to whatever format. I just want to load the label in a new layer in front of the current image, then flatten them to weld it all together. Again, thanks for taking the time to help out newbs! RE: Cannot load .svg to label to images - Ofnuts - 12-29-2023 (12-28-2023, 09:42 PM)Someone Wrote: GIMP 2.10.32 Python Console This means that label.svg doesn't appear to have meaning full content. I get this message if I use an empty SVG file: Code: <?xml version="1.0" encoding="UTF-8"?> So what have you got in that file? RE: Cannot load .svg to label to images - Someone - 12-30-2023 (12-29-2023, 12:59 AM)Ofnuts Wrote:(12-28-2023, 09:42 PM)Someone Wrote: GIMP 2.10.32 Python Console Ok, sweet, that was the clue i needed. After saving as a simple .svg instead of an Inkscape .svg, culling the xml data, and simplifying the paths a bit i got it to load! |