2

I am not a graphic designer. I am using PSTricks to draw mathematical and technical diagrams for daily works. With PSTricks, we need points to draw.

Reproducing the following, for example, is tedious in PSTricks if we have to locate the points by trial and error.

enter image description here

Question

Is there any free visual tool to trace the above image to obtain the critical points as minimal as possible?

5
  • The head is a circle. I will not trace it for sure. Nov 22, 2018 at 16:34
  • PSTricks is not widely used by us. Photoshop, Illustrator, InDesign, GIMP and Inkscape are the most well known pieces here. Have you any method to convert Inkscape (free) drawings to your format? Redrawing this in Inkscape manually produces Bezier curves (=paths) with few control nodes. SVG is Inkscape's native output format.
    – user82991
    Nov 22, 2018 at 19:56
  • @user287001: Does Inkscape have a tool to trace (by importing the image first and then tracing as we usually do with semi transparent paper when not using computer)? Nov 22, 2018 at 19:59
  • Tracing is possible automatically as well as manually(=drawing over an existing image), but automatic tracing makes surely ten times more nodes than drawing manually. Inkscape traces all lines and curves as filled areas. I see an answer has appeared about the subject. Here's a screenshot of automatic tracing. dropbox.com/s/y49v5t1ndi3nkus/MorsGris.jpg?dl=0 There's plenty of nodes. I recommend manual drawing if you really need minimum number of nodes. Lock the image under to keep it in place as you draw. Use pen and ellipse tools. Adjust the curvature with the node tool.
    – user82991
    Nov 22, 2018 at 21:57
  • 2
    Not certain I'd even bother tracing such figures. That, and similar images, would be very quickly manually traced - and manual tracing always results in better final images.
    – Scott
    Nov 22, 2018 at 22:07

1 Answer 1

3

user287001's suggestion to use Inkscape is supported by another StackExchange post, which says verbatim:

With Inkscape I can save an .svg files to PSTricks (.tex) via the Save As dialogue.

I did a copy image on the pig, pasted it in Inkscape, performed a Path, Trace Bitmap using colors as the separation parameter. The result was just about perfect. I checked the path nodes within Inkscape and found they are simplistic, rather than overly complex, although that has more to do with the simplicity of the image rather than the capabilities of the program. I've done the same on more jagged images and got thousands of path nodes.

As suggested in the other SE post, I was able to Save As and select LaTex as the format.

The resultant text file was then opened in a text editor and has the preface that the file must be used with PSTricks. Posting the resulting file generated 111323 characters and the SE is limited to 30k characters, otherwise I'd dump it here for you. Here's the first few lines:

%LaTeX with PSTricks extensions

%%Creator: inkscape 0.92.3

%%Please note this file requires PSTricks extensions

\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}

\begin{pspicture}(793.7007874,1122.51968504)

{

\newrgbcolor{curcolor}{0.99215686 0.99215686 0.99215686}

\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]

{

\newpath

\moveto(-1588.21428283,517.14288)

\lineto(-1588.21428283,1117.1428611)

\lineto(-985.71428031,1117.1428611)

\lineto(-383.21431181,1117.1428611)

\lineto(-383.21431181,517.14288)

\lineto(-383.21431181,-82.85712)

\lineto(-985.71428031,-82.85712)

\lineto(-1588.21428283,-82.85712)

\closepath

It took me three minutes to perform the above tasks.

EDIT: Noted in comments that automatic tracing generates excessive nodes (points), but it wasn't the case for the pig image. Also Inkscape provides for Path, Simplify, which works great to reduce node count where applicable. In the previously mentioned thousands-of-nodes reference, I was able to reduce segments with 20 or more nodes to four or five nodes per segment. Slightly tedious, but worthwhile for the result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.