Centerline Trace Error - no proper xml returned

Post questions on how to use or achieve an effect in Inkscape.
BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Centerline Trace Error - no proper xml returned

Postby BijB » Mon Sep 11, 2017 9:08 am

Hi, I am a Newbie here.

I have been trying for two days to get this centerline trace extension installed, and working.

I have the PDF file - https://inkscape.org/ar/gallery/item/10 ... IH0Rhk.pdf

I searched google, and here, and read threads started by trader4300. I ran the command autotrace --version (version #0.31)

I checked my Paths and added to where inkscape said to put the extensions (... appdata\roaming\inkscape \extensions and ... appdata\roaming\inkscape \extensions\autoT)

I copied three files, and my Autot(race) folder to this folder - it will not let me post an inline pic.

And this is what I get:

autotrace_cmd: autotrace --centerline --input-format=pbm --output-format=svg
ERROR: no proper xml returned: ''
Traceback (most recent call last):
File "centerline-trace.py", line 448, in <module>
e.affect()
File "C:\Program Files\Inkscape\share\extensions/inkex.py", line 283, in affect
self.effect()
File "centerline-trace.py", line 410, in effect
xml = inkex.etree.fromstring(path_svg)
File "src/lxml/lxml.etree.pyx", line 3228, in lxml.etree.fromstring (src/lxml/lxml.etree.c:79609)
File "src/lxml/parser.pxi", line 1848, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:119128)
File "src/lxml/parser.pxi", line 1736, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:117808)
File "src/lxml/parser.pxi", line 1102, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:112052)
File "src/lxml/parser.pxi", line 595, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:105896)
File "src/lxml/parser.pxi", line 706, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:107604)
File "src/lxml/parser.pxi", line 646, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:106750)
File "<string>", line 0
lxml.etree.XMLSyntaxError

Now, my Python27 folder, under Inkscape is empty - when I installed Python, it set it's own directory. And, when I reinstall Inkscape (probably 5 times, so far :) it always sets up the folder, with nothing in it.

I can't help but think that I am missing something pretty simple, but I have tried everything that I could think of. Putting files in different locations, and resetting paths to there, installing and reinstalling both the extensions (AutoTrace and Centerline Trace).

The really annoying thing is, that I have gotten it to run, but the output was not good, and then, I would try something else, and get the error again

Am I supposed to be tracing the bitmap first, and then running the center trace? I have tried opening SVG files, and they don't work any better.

If someone could help me out, I would be most grateful. Oh, and I am certainly no super user, but usually figure it out, but, I am just getting no where with this.

Hopefully, this is in the right location. If not, could you point me in the right location?

Thanks -
mb

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Mon Sep 11, 2017 11:19 pm

:-(

I assume you're on Windows, using Inkscape 0.92.2?

As you have had it work, have you changed anything in your setup after that?
I suspect you might just not have selected the correct object, it happens easily.

Centerline trace is supposed to work on bitmap images directly. It's not going to work with vector data.

During installation (if you need to redo it... :-/), make sure you select to install python. Also make sure to properly uninstall any previous Inkscape versions first.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Tue Sep 12, 2017 3:33 am

Hi Moini -

Ys, 92.2 and Yes, Windows 10. I was so busy trying to get all the details, I obvs missed some big ones!

Yes, it would work on a .jpg, but then I brought in another, and it gave me that error. I did them one right after the other, so, maybe the second wasn't a .jpg. I will check and get more detail when I can get on my computer again. Do you think I need to convert my .jpg to .bmp? I will try that later.

What do you mean by not selecting the correct object?

I installed Python separately. because I had to, to accomplish the Pip and Pillow install in the prior steps on the .pdf file. When I installed Inscape, the Python 2.7 box was checked, but the folder was empty.

When I unistalled, I even cleared the Paths and deleted the entire folders - both in the program files, and in the app data sub folders.

Thank you for your help.
Last edited by BijB on Tue Sep 12, 2017 3:35 am, edited 1 time in total.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Tue Sep 12, 2017 6:12 am

Thanks for the additional details!

Please let us know how it goes when you try again. A conversion from one file format to another should not be necessary, as far as I know. jpg should be fine.
If it doesn't work, though, can you share an SVG file, so we can try to reproduce?

Not selecting the correct object is easy when using an extension - after you run it, it automatically deselects everything in the drawing.
After tracing, there can be an SVG object on top, which people may mistake for the bitmap image.
These happen frequently to users who don't expect things to work like this, so I thought I'd mention.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Tue Sep 12, 2017 9:58 am

Hi -

Thank you again for trying to help me!

Okay, so I reinstalled, I installed Python under the python directory in Inkscape.

Now, I am getting this error: Error: Cannot import PIL. Try apt-get install python-pil

I reinstalled PIP and Pillow, and, after the above error, I am guessing that Pillow is not installed correctly. Forgive my uninformed question, but, how can I verify that Pillow is installed where it should be. What file name should I see? I read that PIL is now Pillow, but, I thought I would see something under "Scripts", but, I don't know the name and extension I should be seeing.

I am attaching a file. It is a line drawing, but, it doesn't work.

Thanks -
mb
Attachments
FCLighthouse.jpg
FCLighthouse.jpg (39.98 KiB) Viewed 5407 times

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Wed Sep 13, 2017 7:38 am

I think you should be able to find a directory named PIL in your_Inkscape_Python_directory/lib/python2.7/site-packages/ directory. Not sure though, I'm not on Windows.
I'd also suggest manually (with a felt-tip pen or similar) tracing the original drawing, if possible. It doesn't have good contrast, the tracing results (tried with different settings) look quite bad for me.
Attachments
Bildschirmfoto_2017-09-12_23-37-51.png
Bildschirmfoto_2017-09-12_23-37-51.png (154.53 KiB) Viewed 5368 times
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Centerline Trace Error - no proper xml returned

Postby Lazur » Wed Sep 13, 2017 8:38 am

^Yes, definitely try a copy with a larger resolution and without that compression noise.

Raising the contrast in post production won't give you back the details.

https://www.dropbox.com/s/h79koebnduzcx2q/trc.svg?dl=0

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Centerline Trace Error - no proper xml returned

Postby v1nce » Wed Sep 13, 2017 8:52 am

not that bad.

maybe
try http://hi.cs.waseda.ac.jp:8081/ to try to clean up before tracing

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Wed Sep 13, 2017 11:39 am

okay, pdf is a shot of the error that I am getting, and a pic of the drive where PIL is located. Is that something with the Path, that it is not finding it?

Here is another picture that I was trying, but, I don't think it will work till I get the PIL issue resolved. (Don't Judge ;) I use these outlines to trace onto paper to paint. I am hoping that I can take a real picture, just get the outline, and remove everything but minimal lines, and use those.

Maybe I will never be able to do that, so maybe this is a fool's errand anyway. I am attaching a picture that I want to make into a line drawing The Lighthouse - pmpJH jpg) - is it even possible?

Thank you all for trying to help me out.
mb
Attachments
TProll.jpg
TProll.jpg (28.42 KiB) Viewed 5315 times
pmpLH SapirPhotog.JPG
pmpLH SapirPhotog.JPG (26.9 KiB) Viewed 5315 times
directories.pdf
(146.61 KiB) Downloaded 214 times

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Wed Sep 13, 2017 11:32 pm

The lighthouse won't work with centerline trace, no.
The toilet paper will work well.

If you're after vectorizing photos, I think you'd better learn to do manual tracing. It doesn't take a lot of time, and it's going to /always/ work.

As you've only included the directory structure, but not the contents in your screenshot - can you tell us if the PIL directory contains any files?
What do you get if you run

Code: Select all

cd "\Program Files\Inkscape"

(Enter)

Code: Select all

python\python

(Enter, this will hopefully open an interactive python shell on Windows...)

Code: Select all

from PIL import Image

(Enter, hopefully you will get some info now)

Code: Select all

import sys

(Enter)

Code: Select all

print(sys.executable)

(Enter, this will give you info about the location of the python you're currently running)

Can you post a screenshot?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Centerline Trace Error - no proper xml returned

Postby Lazur » Wed Sep 13, 2017 11:46 pm

Or if you want to trace photographs, you may try something like this.

Also related this video, and the crosshatch topic.

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Thu Sep 14, 2017 1:02 am

Thank you - I will check out the PIL deal again tonight.

I was hoping to use this, to get the traced image in the computer, as there is a method, that quite simply takes the laser printed image, and transfers it to the WC paper. (It uses acetone, in case you were wondering).

When I took my images, and did the outline path, in Inkscape, the lines were doubled, as it uses that find edge for creating image. I read that if you had that, you could use centerline trace, to get a single line. So, I thought, if I got the edges image, and sent it through centerline trace, it could work. (I'm lazy :)

But, I only want minimal lines, so, maybe it would just be worth it to get more proficient on Inkscape, and be able to just take my image, and draw the minimal lines that I need. (Oh, rereading Moini's post, this is what you are meaning by "manual tracing", isn't it - ha! We use computer's so much, that manual doesn't even mean the same thing anymore.)

I am at work, so can't really check that video out right now, but will do at home.

Thank you -
mb

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Thu Sep 14, 2017 1:55 am

Yes - I meant manual tracing = drawing.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Thu Sep 14, 2017 3:07 am

Hi Moini -

Yeah, I can't draw - which is why I am looking for a way to turn a pic to a line drawing. Even if I could draw, it wouldn't be in the computer, unless I scanned it, risking even more noise, to get a laser printout.

I think learning Inkscape better is probably the way to go.What I would like to get, from the above Lighthouse, is the shape of the lighthouse, maybe a couple of lines for the stairs, the Horizon, and maybe an outline or two for the rocks. Maybe, like 8 or ten lines - half of them would probably be straight lines. That would also let me size it as I want, without all the pixelation of the lines

Thanks -
mb

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Thu Sep 14, 2017 10:01 am

Hi - Me again!

PIL Files just shows that the PIL folder is populated with 185 files.

Attached PIL is the command sequence. It seems like I had to go through things twice to get something to work, but, bottom line, it did work. Oh, it looks like first time I did the Executable lines, I use executables - no wonder it didn't work. Then, played around a bit, and went back and that was when it worked.

Paths is just the Path edits. I edited it, section by section, all the way back to C:\Program Files\Inkscape\lib - no joy... The error message is the same as yesterday - Error: Cannot import PIL. Try apt-get install python-pil

Am I correct in that Inkscape is not finding PIL? Is PIL not installed in the right place?

Thank you for all your efforts!

mb
Attachments
PIL Files.pdf
(172.07 KiB) Downloaded 215 times
Paths.pdf
(151.41 KiB) Downloaded 217 times
PIL.pdf
(154.52 KiB) Downloaded 216 times

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Fri Sep 15, 2017 8:43 am

I can take a closer look some time next week, if nobody else had an idea in the mean time - can you bump the topic then, as a reminder?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Fri Sep 15, 2017 8:52 am

You know what, don't even worry about it. I think I can just go about it a different way.

I thank you, you have helped me so much, and, even though this never got to work, I learned a lot!

Sincerely -
mb

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Fri Sep 15, 2017 9:03 am

:-( Being somewhat involved in development of (tiny bit)/support for that extension, I have an interest beyond this thread in getting it to work for others... but I'm busy this weekend.

But I agree that it's probably not the best solution for all kinds of drawings - it works best for line drawings, and will produce garbage for photos.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Fri Sep 15, 2017 9:20 am

If you want to pursue, because you want to know, I would be fine continuing to try to troubleshoot. The time frame is not a problem.

If you would like me to bump it up, I can. Just let me know :)

Thanks -
mb

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Centerline Trace Error - no proper xml returned

Postby Moini » Fri Sep 15, 2017 9:31 am

I just set myself a reminder - it would be very nice to have your help!
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Fri Sep 15, 2017 10:08 am

You got it. I usually am on line in the evenings, so I can try anything, after that.

Oh, so I uninstalled Python, installed under Inkscape, took the numbers out of the folder so it is now: C:\Program Files\Inkscape\Python

Uninstalled and reinstalled Pillow, as per the .pdf instructions, and this time, I could install exactly as the pdf said. I had to take out the first python, when running the steps before.

I was using an autotrace from Sourceforge, but found your link, on another post, for just the exe, and copied that over to extensions.

So, whenever, that is where I am...

Thanks -
mb

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Centerline Trace Error - no proper xml returned

Postby ~suv » Fri Sep 15, 2017 2:09 pm

Please note: the current stable Inkscape 0.92.2 packages for Windows include the latest PIL/Pillow python module - users do not need to install it themselves anymore, or otherwise tinker with the Python installation that is bundled with the Inkscape package.

A quick test of latest centerline-trace with Inkscape 0.92.2 (installed from 7zip archive into custom path) on Windows 10 works just fine for me, following these steps:

  1. clone the github repo of inkscape-centerline-trace
  2. copy centerline-trace.inx, centerline-trace.py to Inkscape's User extensions folder [1]
  3. download the autotrace binary from autotrace-win64-binaries github repo.
  4. copy the downloaded autotrace.exe to Inkscape's User extensions folder [1]
  5. launch inkscape
  6. import bitmap image (embed)
  7. with embedded image selected, apply 'Extensions > Images > Centerline Trace 0.7'
done.

---
[1] See 'Inkscape Preferences > System > System info > User extensions' for the location of user-installed custom extensions.

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Fri Sep 15, 2017 11:27 pm

Hi - When I install Inkscape, it does not install python. I am installing 92.2.1

I looked it up, I think it is only installed with Mac, not Windows.

Is there a place for download instructions, all I have is the odd that installs the pup and pillow separately.

Thanks -
mb

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Centerline Trace Error - no proper xml returned

Postby ~suv » Sat Sep 16, 2017 12:17 am

BijB wrote:When I install Inkscape, it does not install python. I am installing 92.2.1

There is no version "92.2.1" - I would recommend to get the latest stable release (currently Inkscape 0.92.2) from inkscape.org, especially if you plan to work with custom extensions that require the PIL python module (the PIL module is either broken or missing in Windows packages of earlier Inkscape releases).

BijB wrote:I looked it up, I think it is only installed with Mac, not Windows.

No, it is the other way round:
  • Past and current Inkscape packages for Mac OS X do not include Python itself, only the few additional python modules required by the bundled extensions (lxml, numpy etc.) because Mac OS X / macOS already provides Python 2.
  • On Windows however, there is no Python provided by the OS at all. Past and current Inkscape packages for Windows install their own copy of Python, along with the few additional python modules required by the bundled extensions.
    Depending on the installer (EXE or MSI), users may choose to not install the bundled distribution of Python 2.7 in the installer's Custom setup type, but the default is to install it.

Edit:
For example, the 64bit MSI installer (default setup) installs these files:

Code: Select all

<...>
C:\Program Files\Inkscape\libpython2.7.dll
<...>
C:\Program Files\Inkscape\python.exe
C:\Program Files\Inkscape\pythonw.exe
<...>
C:\Program Files\Inkscape\lib\python2.7\
<...>
C:\Program Files\Inkscape\lib\python2.7\site-packages\PIL\
C:\Program Files\Inkscape\lib\python2.7\site-packages\Pillow-4.1.1-py2.7.egg-info
<...>
and the centerline-trace extension works as expected using the steps described in my earlier comment.

BijB
Posts: 13
Joined: Mon Sep 11, 2017 8:30 am

Re: Centerline Trace Error - no proper xml returned

Postby BijB » Sat Sep 16, 2017 8:15 am

I fat fingered the .1, in the version, oops...

You are correct, it works. I THOUGHT that was what I was doing - ha! Got wrapped around the axle about finding Python, because the folder was empty.

Thank you - I do appreciate your help.


Return to “Help with using Inkscape”