11

I'm working on wedding invitations and there's a logo that identifies the braid and the broom. Originally this was taken from the internet in a low resolution and quality that ruins up the overall aspect of the invitation. I'd like to draw this complex figure using Tikz, which I show below:

Logo

As you can see, the quality of the picture isn't very high and is going to look worse when it gets printed out.

There are a couple of open flanks on which I'd need some advice, to say:

Contour of the heart:

I'd like the heart to look just like the one located on the lower right corner of the following image: http://1.bp.blogspot.com/-BDWeR0RCqfU/Tec8AcrN6MI/AAAAAAAAFDw/CsikMUj4PYI/s1600/HeartCurves_801.gif That means plotting a parametric equation. So far, I've been trying to plot the equation, but I don't find a way to plot such a function. Here is the code I've tried

 \documentclass[10pt,final]{article}
 \usepackage[utf8]{inputenc}
\usepackage[paperwidth=21cm, paperheight=10.5cm, top=4mm, left=8mm, right=8mm, bottom=4mm]{geometry}
\usepackage{fontspec}
\usepackage[german]{babel}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}[domain=0:4]
      \draw[->] (-3,0) -- (4.2,0) node[right] {$x$};
      \draw[->] (0,-3) -- (0,4.2) node[above] {$y$};
      \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
       \draw[scale=0.5,domain=-3:3,smooth,variable=\x,red]  plot ({2*cos(\x r)*cos(\x r)*cos(\x r)},{\x});
    \end{tikzpicture}
\end{document} 

The question here is how to plot the parametric function.

Branches:

I've wondering how to produce the lines representing the branches within the heart. I was considering to produce the lines using the classical control points, but I guess there must be better ways to produce them. Also, another problem that I see is to define the branches within the contour of the heart.

Leaves:

For the leaves I have a simple solution that uses the control points.

\documentclass[10pt,final]{article}
 \usepackage[utf8]{inputenc}
\usepackage[paperwidth=21cm, paperheight=10.5cm, top=4mm, left=8mm, right=8mm, bottom=4mm]{geometry}
\usepackage{fontspec}
\usepackage[german]{babel}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\fill [green](0,0) .. controls (1,1)   and (2,0.5).. (3,0);
\fill [green] (0,0) .. controls (1,-1)  and (2,-0.5).. (3,0);
\draw [green](-0.5,0)--(0,0);

    \end{tikzpicture}
\end{document} 

I could use the @Qrrbrbirlbel's answer (Use a custom shape as a "building block") as a base to define the leave as shapes, but the problem that arises here is to place the leaves at specific point of the branches at specific angles.

Charlie
  • 1,135

2 Answers2

16

How to convert image to tikz using inkscape

  1. Open inkscape and import the image

  2. Select the image and use Trace Bitmap...

enter image description here

  1. For the image you posted I selected the following configuration:

enter image description here

  1. The resulting vectorised version of your image:

enter image description here

If the lines are not smooth enough or too smooth, these parameters can be adjusted in the trace options.

At this point I would simply save the vector image as .pdf and use it with \includegraphics.

  1. To convert the image to tikz, there is an extension available called svg2tikz. (Be careful, the resulting file size may be huge)

enter image description here

9

Not a real answer - just a fake one to post this image, which was traced with potrace and polished a bit with inkscape

enter image description here

Dropbox link https://www.dropbox.com/sh/jk4wa9vcyeklqlg/AAAhva-i-pCASvhgLoI3v8Vba?dl=0

Edit: steps of the conversion

  1. Opened with Gimp, converted to grayscale, and then to black/white using the "threshold" tool

  2. Converted to pbm using imagemagick's convert (I assume Gimp could have done that, too)

  3. Traced with potrace -s picture.pbm

  4. Opened the svg file produced by potrace with inkscape and did a bit of manual tweaking of the contours.

  • 2
    +1, Nice man! Would you mind giving a more detailed description on how you did the conversion? Like what options (if any) of Potrace you used and what do you mean by "polished". I'm not so used to converting graphics and its a rather useful thing to have detailed. :D – Guilherme Zanotelli Nov 25 '16 at 18:45
  • 1
    Apperantly there this tool SVG2TikZ that can convert from SVG format to TikZ, that maybe helpful to the OP. – Guilherme Zanotelli Nov 25 '16 at 18:49
  • @Guilherme - see edited answer. As to converting to TikZ, I don't really see a need for that; instead, I would just save as pdf from inkscape and then use \includegraphics. – Michael Palmer Nov 25 '16 at 19:09
  • 1
    i don't too. It was only a suggestion. Meant for the OP. ;) thanks for the steps, that's very helpful! – Guilherme Zanotelli Nov 25 '16 at 19:37