Any help is really appreciated.
Any help is really apprecaited.
Thank you so much! Very helpful.
Hi. I have successfully used Potrace to convert a png image to an eps file. The png image contains only horizontal and vertical lines, but the Potrace eps output shows points midway between lines. I'm new to eps files so perhaps this is normal but I dont understand how these mid-points contribute to the shape and it seems like they could be omitted. Any help is appreciated!
Hi. I have successfully used Potrace to convert a png image to an eps file. The png image contains only horizontal and vertical lines, but the Potrace eps output shows points midway between lines. I'm new to eps files so perhaps this is normal but I dont understand how these mid-points contribute to the shape and it seems like they could be omitted. Any help is appreciated!
https://drive.google.com/file/d/1wRtwvUc5DIXsjrNvBx8OAWK0cYo_-hM3/view?usp=sharing
Hi. I have successfully used Potrace to convert a png image to an eps file. The png image contains only horizontal and vertical lines, but the Potrace eps output shows points midway between lines. I'm new to eps files so perhaps this is normal but I dont understand how these mid-points contribute to the shape and it seems like they could be omitted. Any help is appreciated!
Hi. I have successfully used Potrace to convert a png image to an eps file. The png image contains only horizontal and vertical lines, but the Potrace eps output shows points midway between lines. I'm new to eps files so perhaps this is normal but I dont understand how these mid-points contribute to the shape and it seems like they could be omitted. Any help is appreciated!
Thanks for the suggestion. I ended up removing the Intel-specific tweaks altogether, since the code where it was used wasn't a performance bottleneck.
I386 feature should not be enabled on non-x86 architecutre
I386 feature should not be enabled on non-x86 architecutre
Minimum segment length
I don't know, but I kept a copy :) I just put it here: http://potrace.sourceforge.net/thirdparty/Mallard/
I his project still available somewhere? Never mind the correct url is https://cscott.net/Projects/Mallard/
I his project still available somewhere? Url is 404.
I his project still available somewhere?
Great! I'm glad it worked out.
Yes! That finally worked. Just needed to see the steps. Thank you so much for sending that. I wanted to show you a drawing I'm working on and the differences of the renders. As a designer who works on brands, this ensures my original ink drawings aren't compromised when vectorized. So thanks again!
OK, please watch this video: http://potrace.sourceforge.net/video/potrace-mac-install.mp4 If that still doesn't work, I recommend buying Image Vectorizer http://image-vectorizer.com/ . It's what people use on Macs.
Hey Peter, I'm still trying to figure this out. I'm not sure what to type in Terminal before 'potrace-v' or where to place the 'potrace-1.16' folder once its downloaded and unzipped.
If you've successfully installed Potrace, you should be able to open up a Terminal (that's what the command prompt is called on a Mac) and type "potrace -v" in it. It should output the version number and some information about Potrace. Then you can use Potrace in exactly the same way as you did on Windows.
I was able to install succesfully but I'm not sure how to run it or use it now. Sorry I'm so confused by this. On Windows I used to use the command prompt to convert a file from svg to eps but not sure how to get there now.
Nevermind. I think I figured it out! Will update when it is finished downloading/installing. Thank you for your time and attention.
So I'm not sure what to do then.
That message is not related to Potrace. Apple is asking you to upgrade some software. You should ignore it, or not, but it has nothing to do with Potrace. In particular, it is not an error message. It is an informational message from Apple.
Ok I tried that out and I kept getting this message: The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh. For more details, please visit https://support.apple.com/kb/HT208050. bash-3.2# **
When entering a password, it is normal for the password characters not to be shown on the screen. This is to prevent a person looking over your shoulders from seeing the password. You have to enter the password and press enter.
Hey Peter, I tried both of these out and it led to a Password needing to be entered but it wouldn't let me type anything. I'm attaching a screen shot. I tried deleting what I had and re-downloading and tried again and got the second screen shot attached. I tried the su - thing but it went back to asking for a password and not letting my type. Not sure what I'm doing wrong. Thank you for your attention to this!
Hi, thanks for writing and sorry for the delay in replying. I assume you've downloaded the file potrace-1.16.mac-x86_64.tar.gz, which is an archive containing a bunch of other files. Perhaps you are able to open this archive by double-clicking on it. Otherwise, you might try something like the following in a Terminal: cd ~/Downloads tar -zxf potrace-1.16.mac-x86_64.tar.gz cd potrace-1.16.mac-x86_64/ sudo bash cp potrace mkbitmap /usr/bin I don't have a Mac right now to try it on, so please let me...
Illustrator Needing Help
Hey Peter, That has to be the coolest reason! Thanks for the explanation, that makes sense. I prefer the interface over GitLab I guess, and I haven't used BitBucket in years. Not sure if all of those have anything similar to GitHub Pages either, but it's super handy for docs. Just personal preference though mostly and because other projects I work on use it, so it's what I'm used to :) Would you ever consider changing it to something else, or would it not be worth it?
Hi Ashleigh, there is no particular reason, except that Potrace has been on Sourceforge since 2003. That was five years before Github existed, and two years before Git existed. Sourceforge has hosted and supported open source software long before Microsoft (the current owner of Github) jumped on this bandwagon. It has always worked well for my purposes, and I suppose I didn't have any reason to change it. Out of curiosity: is there any reason you prefer Gibhub over Gitlab, Bitbucket, or any of the...
I'm curious as to why use SF. I contribute to some other open source projects but they're all on GitHub. The documentation lead me here, since I find it a little hard to follow in the current state. I generally use something like GitHub Pages + Asciidoc + Antora to generate docs sites, so I was wondering if there's any interest in doing something like this for Potrace.
The problem is solved by itself. Both potrace and rsvg-cairo produce PDF “from one object”, and not from several paths. PDF optimization by this method is not possible.
Good. It remains now only to figure out how to transfer all the same path to defs.
I don't know specific programs that do this either. But you could achieve replacing "<path d="M{x0} {y0} ..." by "<g transform="translate({x0},{y0})"><path d="M0 0 ..." with a relatively simple regular expression, such as sed 's/<path d="M\([0-9]*\) \([0-9]*\)/<g transform="translate(\1,\2)"><path d="M0 0/g' Just pipe the SVG output of Potrace through that command. You might have to add a few </g> tags as well, which can be done with a (more complicated) sed script, or an Awk script, or a Perl script,...
Hi Peter, i do not know the programs you mentioned. Tell me? PS: At least replace: <path d="M{x0} {y0} ... to: <g transform="translate({x0},{y0})"><path d="M0 0 ...
Hi Peter, i do not know the programs you mentioned. Tell me?
Use <defs> in SVG?
Hi Zvezdochiot, thanks for the suggestion. It sounds like this functionality could be implemented by modifying the output of Potrace, rather than modifying Potrace itself. I am guessing that there already exist some programs for manipulating SVG images that could do this, or it would be easy to write such a program. As such, I probably will not add this as a feature to Potrace.
Use <defs> in SVG?
Hi Ray, thanks for writing. No, unfortunately Potrace does not offer centerline tracing. From the FAQ: Question: Does Potrace provide centerline tracing? Instead of tracing the contour of my image, I just want a single line in the center of each stroke. Answer: No, Potrace is not designed to do centerline tracing, and for technical reasons, it is unlikely that this will change in the near future. Algorithms used for centerline tracing are quite different than those used for outline tracing; it might...
Single Path Option?
Hi Marc, Potrace does not output any stoked lines. It outputs filled areas. So setting a linewidth would not make sense. Best wishes, -- Peter
Is there a pameter that would allow the user to set the linewidth for ps and pdf output ? I have not been able to find this in the man pages so I assume it does not yet exist. Is this a feature you would consider adding ? Marc
Is there a pameter that would allow the user to set the linewidth for ps and pdf output ? I have not been able to find this in the man pages so I assume it does not uet exist. Is this a feature you would consider adding ? Marc
Potrace 1.16 released
different results depending on compiler optimizations
Peter, thanks for the prompt reply and the helpful information. The patch indeed fixes the potrace tests. In the test suite of dvisvgm, I currently don't check the similarity of the shapes described by the generated paths but just the command sequences (moveto, curveto etc.) and its parameters as computed by potrace_trace(). That's obviously too naive an approach. However, the issue has only ocurred since GCC 8. The generated paths now differ quite significantly between optimized and unoptimized...
P.S.: another reason the tolerances must be adjusted from time to time is variations in Ghostscript. The test suite uses Ghostscript to render the traced files, and then compares the image to the expected output. Even small changes in Ghostscript's antialiasing routines can therefore require a recalibration of the test suite (not Potrace itself). It doesn't look like this was the problem in your user's case, but I thought I'd mention it since it does affect the reproducibility of the test suite.
Hi Martin, Potrace does use some floating point arithmetic, and due to rounding errors, the results can indeed depend on compiler optimizations (and presumably there might be a difference between 32-bit and 64-bit architectures as well, and between different compilers and OSs). One of the reasons is that processors internally use more than 64 bits to represent floating point numbers. Without compiler optimization, each intermediate result is converted to 64 bits, but with optimizations, the intermediate...
different results depending on compiler optimizations
Too many </g> markers in SVG output
OK, great. Thanks for confirming. I will close the ticket. Please feel free to open another one if you should encounter this issue again. (By the way, you need to use the --opaque and --group options to get multiple <g> tokens - this might help in replicating).
Please close the ticket. I'm not sure what had happened. As of today, like you, I was not able to replicate the problem either. I'm scratching my head on this one. Prior to reporting the problem, I was able to replicate the problem. May have been a software update which could have changed a library or two. On 4/16/19, Peter Selinger selinger@users.sourceforge.net wrote: Thanks for reporting this, but I am not able to reproduce this problem. Could you please post the command line arguments you used,...
Thanks for reporting this, but I am not able to reproduce this problem. Could you please post the command line arguments you used, and attach the resulting SVG file? When I try to run a similar example, I get: 1 token of the form <g transform="..." fill="..." stroke="..."> 33 tokens of the form <g> without attributes 34 tokens of the form </g> This seems like correct SVG to me. -- Peter Edit: the sourceforge editor inserted additional </g> tags in my message above. Correcting.
Thanks for reporting this, but I am not able to reproduce this problem. Could you please post the command line arguments you used, and attach the resulting SVG file? When I try to run a similar example, I get: 1 token of the form <g stroke="..." transform="..." fill="..."></g> 33 tokens of the form <g> without attributes</g> 34 tokens of the form This seems like correct SVG to me. -- Peter
Too many </g> markers in SVG output
Hi Peter, thanks for clearing this up for me (and sorry for the delay in answering). After also reading the library documentation (which, by the way, is great), I think I understand better why potrace can't really do what I need. As for your suggestion, I'm going to assume that by subtracting, you mean <mask> out the black from the white background. The problem with that (for me) would be that I would get the result as one single path (even if it is discontinuous), whereas I'd really need to have...
Hi Peter, thanks for clearing this up for me (and the delay in answering). After also reading the library documentation (which, by the way, is great), I think I understand better why potrace can't really do what I need. As for your suggestion, I'm going to assume that by subtracting, you mean <mask> out the black from the white background. The problem with that (for me) would be that I would get the result as one single path (even if it is discontinuous), whereas I'd really need to have each component...
Hi Milad, the Potrace API is only for tracing. It doesn't deal with reading BMP files or writing SVG. You could use other existing libraries for these tasks (libbmp for reading BMP files? Cairo for outputting graphics?). Or you could somehow repurpose the code in bitmap_io.c and backend_svg.c. It's not designed as a library though, and it uses global variables, e.g., the info structure defined in main. It would require a bit of refactoring.
Thank you far your answer and thank you so much for creating Potrace. Great work. Yes, I'm aware of color vectorization in Inkscape but good for them they use Potrace iternally. I've included the Potrace API in my C++ project but I just didn't know how to use it. There was a help about it on your website but as it said, it didn't explain the whole API, like how to read a BMP file and how to get the SVG result as string to work with it. How should people learn the API? By looking at the source co...
Hi Milad, you can't automate this process within Potrace, but Inkscape has the ability to automatically convert color images by the process you describe (and using Potrace internally on each color), and you can save the result directly as a PDF or PNG. I hope this helps, -- Peter
I have color images with low number of distinct colors (8 to 20) and I'd like to first vectorize it with Potrace and then convert the result to PNG with a given dimension. I was able to do it with the following technique but it's very slow specially with images that have more distinct colors: 1. For each distinct colors in the image create a BMP file showing pixels that are in that color. 2. Convert each BMP file to SVG using Potrace. 3. Create one final SVG by getting each SVG file created by Potrace...
Hi Jan, that's an interesting question. As you have noticed, Potrace really only cares about the black parts; it considers white to be background. With --opaque, only interior background regions will be colored in. There is not easy solution within Potrace itself, as Potrace is not currently tailored to handle 3-way intersections (which you get where a black/white border hits the outside border of the image). One external solution is to load the black path (without --opaque) into SVG, create a white...
Hi, let's assume I have an image consisting of three vertical bars (like, say, the French flag) that are colored white (left), black (middle) and white (right). If I trace this as SVG, I get one black path for the middle stripe, while the background is defined implicitly (as far as I can tell). I would like to get both of those as separate "white" paths. In other words, is there a way, for a two colored input image, to get two sets of mutually exclusive (let's ignore https://sourceforge.net/p/potrace/discussion/300716/thread/55e01763/...
Hi Jesper, I'm glad you were able to solve the problem. I have not encountered the LNK2019 error before, but it might be related to the difference between C and C++. They mangle the function names differently. Or maybe Visual Studio just didn't know where to find the .a file. For the record, on Windows 64-bit, when compiling with MinGW and then trying to use the libpotrace.a in Visual Studio, you can also sometimes get an LNK1223 error "file contains invalid .pdata contributions". This is related...
I found help on Stackoverflow, the solution worked perfectly. https://stackoverflow.com/questions/49189861/how-can-i-include-source-code-written-in-c-from-another-project-into-my-own-proj/49190489#49190489
I want to use Potrace for a C++ project on Windows in Visual Studio, but I have no clue of how to include Potrace into my project. I have tried to compile the C files using Cygwin, and that way create an .a file and then link to it in visual studio, but that didn’t work. Visual Studio were able to recognize the the functions from Potrace, but when running a test program with Potrace(Calling potrace_version() ), Visual Studio got the error “LNK2019 unresolved external symbol _potrace_version referenced...
I want to use Potrace for a C++ project on Windows in Visual Studio, but I have no clue of how to include Potrace into my project. I have tried to compile the C files using Cygwin, and that way create an .a file and then link to it in visual studio, but that didn’t work. Visual Studio were able to recognize the the functions from Potrace, but when running a test program with Potrace(Calling potrace_version() ), Visual Studio got the error “LNK2019 unresolved external symbol _potrace_version referenced...
Hi Jesper, I probably won't be able to offer much help in debugging your code, as I'm not a very proficient C++ programmer. The function page_svg() was not really intended to be used outside of Potrace; it relies on the global data structure "info" which is defined in main.c. Perhaps the problem is that you have not initialized the info structure. It seems that your info.unit is equal to 0, which would give a division by zero error (see the infinite scaling in your SVG file) and would set all pixels...
Hi Gert, thanks for reporting this. (I receive your message 11 days after you sent it, which is probably another sourceforge problem). It seems that the problem has been resolved. -- Peter
Since the recent Sourceforge migration all package downloads seem to be down? E.g. if you try to download this http://potrace.sourceforge.net/download/1.15/potrace-1.15.linux-x86_64.tar.gz you get "Project web is currently offline pending the final migration of its data to our new datacenter." the last 3 days. I guess Sourceforge changed the directory structure, which is not yet updated on the page.
Hi, I’m Currently looking into how I can use Potrace to convert bitmaps to DXF files, and i’d like to use page_dxf() to generate the DXF file. However i’m having trouble exporting the bitmaps correctly when using page_dxf(). When I look into the file all the data is zeroes. I have also tried using page_svg() and the same is true there, everything is zero. I suspect that is it because i’m not using imginfo_t correctly, in particular I suspect that trans_t is the problem. Is imginfo_t the problem and...
hello Peter. thanks for your direct answer. I can understand that (especially with Autodesk :(() I will investigate other routes as suggested. I don't know how much you are planning to add features in potrace but I would suggest .ply format.it's very easy to handle (for me at least)... cheers luc
Dear Luc, thanks for writing. This will be really difficult for me to debug, because DXF is not a very well-documented format, and I don't have any "official" software for validating DXF files. Basically I developed the DXF backend with the help of a user who had an AutoCAD license, and we debugged it until AutoCAD would accept the output. It is quite possible that the authors of open source software to read DXF files have had the same problems I was having: trying to define a file format based on...
hello and kudos for this great software. I'm trying to export .dxf files from bitmaps to import into a cgi software (houdini) when importing I got this error , and usually it crash. Realloced vlist to 1024 entries Realloced vlist to 1536 entries ..... Realloced vlist to 8704 entries Realloced vlist to 9216 entries invalid point in dxf file I tried to convert the resulting dxf file to .obj with assimp and I can see missing edges in the geometry (screenshot attached) https://imgur.com/a/ExNbE I'm doing...
hello and kudos for this great software. I'm trying to export .dxf files from bitmaps to import into a cgi software (houdini) when importing I got this error , and usually it crash. Realloced vlist to 1024 entries Realloced vlist to 1536 entries ..... Realloced vlist to 8704 entries Realloced vlist to 9216 entries invalid point in dxf file I tried to convert the resulting dxf file to .obj with assimp and I can see missing points in the geometry (screenshot attached) https://imgur.com/a/ExNbE I'm...
Thanks for reporting. This is nothing to worry about. The tests check the accuracy of a PostScript of PDF image by comparing the output of Ghostscript to a reference image. Since the output of Ghostscript is not 100% reproducible, the tests have a certain amount of tolerance built in; in the case of the two failures, the tolerances were not quite enough. The attached patch fixes the issue, but you can also just safely ignore the failed tests.
Hi Selinger. I'm receiving FAIL: 2 at make check at Slackware current with gcc 7.x... Have you ever passed by something similar ? Any suggestions to correct the problem ? Full log goes bellow: ======================================== potrace 1.15: check/test-suite.log ======================================== # TOTAL: 8 # PASS: 6 # SKIP: 0 # XFAIL: 0 # FAIL: 2 # XPASS: 0 # ERROR: 0 .. contents:: :depth: 2 FAIL: postscript-check.sh ========================= Checking PostScript output... data1.pbm:...
heap-buffer-overflow /home/hsalo/src/potrace-1.15/src/bitmap.h:148 bm_dup
OK, I'm closing this bug. It is normal for the program to have some memory unfreed when exiting with an error message.
1.15 with ./configure && make -j valgrind --leak-check=full --show-leak-kinds=all ./src/potrace -o /dev/null ~/potrace-1.15-heap-buffer-overflow-bm_dup.sample ==15482== Memcheck, a memory error detector ==15482== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==15482== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==15482== Command: ./src/potrace -o /dev/null /home/afl/potrace-1.15-heap-buffer-overflow-bm_dup.sample ==15482== potrace: /home/afl/potrace-1.15-heap-buffer-overflow-bm_dup.sample:...
You can close this issue.
I can only reproduce this after building the sofware with american fuzzy lop fuzzer. I'm not sure about the reason.
Do you have some sample EMF files that you could send me? Preferably with corresponding EPS or SVG files for comparison. Thanks, -- Peter
Thanks for quick reply. I'll check this tomorrow.
Henri, I have been unable to reproduce this particular bug. What compiler options are you using? I used these steps: ./configure make CADD="-Wall -fsanitize=address" ./src/potrace -o /dev/null potrace-1.15-heap-buffer-overflow-bm_dup.sample and it is not reproducing it with potrace 1.15 (or 1.14). In either case I get the expected output "invalid ppm file". The same compiler option does reproduce your previous bug 22. Are you sure you attached the correct file? Thanks, -- Peter
heap-buffer-overflow /home/hsalo/src/potrace-1.15/src/bitmap.h:148 bm_dup
OK, thanks!