6

I want to use TiKZ to create a logo for use in letterhead, posters, or whatever. Obviously, a transparent background is ideal, so the logo will fit in nicely wherever it is. So, I did this:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{fontspec}
\usepackage{graphicx}

\usetikzlibrary{decorations.text} % Allows us to wrap text around a circle \usetikzlibrary{backgrounds} % Hopefully, allows transparent background

\setmainfont{Times New Roman}

\begin{document}

\fontspec{Times New Roman}


\begin{tikzpicture}

    \begin{scope}[on background layer]
    \fill[opacity=0] (-3.5,-3.5) rectangle (3.5,3.5);
    \end{scope}

    % Draw double circle with text in the gap

    \draw [
           ultra thick,
           rotate=200,
        ] (0,0) circle (3.5cm);

    \draw [ultra thick] (0,0) circle (2.5cm);

    \path [
        decorate,
        decoration={
          raise=-1.4ex,
          text along path,
          text align={center},
          text={|\Huge|2017}
        },
      ] (180:30mm) arc (180:360:30mm) ;

    \path [rotate=224,
                decorate,
                decoration={
                      raise=-4.5ex,
                      text along path, 
                      reverse path,
                      text align={fit to path},
                      text={|\Huge|Look at this logo}
                      }
            ] (90:35mm) arc (90:360:35mm) ;

    % Include some more words

    \node[label=above:{\huge MORE}] at (0,1) {};
    \node[label=below:{\huge WORDS}] at (0,-1) {};

    % Include an image

    \pgftext{\includegraphics[width=3.5cm]{some_file.png}} at (0pt,0pt);

\end{tikzpicture}

\end{document}

  • I was hoping that the scope with the 0 opacity would do the trick, but it didn't.
  • Then I used Preview (Mac) to export the PDF to a PNG, hoping that that would work. It didn't.
  • I tried to use Inkscape to set the alpha channel to transparent, but... It didn't.
  • I tried to just include the tikzpicture in the poster I was creating, with a resizebox around it to scale it, but that just produced horrific distortion.

This thread suggests using GIMP, but GIMP isn't available to me for reasons that are above my pay grade.

What else can I try?

Update

I did also try including the tikzpicture code in the poster code, and using scale to adjust the size, but that didn't work because of font size issues (I reset normalsize to 60pt, which means that the logo can't work because it specifies huge and Huge fonts.

crmdgn
  • 2,628
  • 1
    How exactly did you resize that tikzpicture? tikzpicture can also resize it self (the scale option) – daleif Jul 21 '17 at 14:52
  • @daleif I resized it with resizebox. It didn't work well.

    The problem with scale is that the main text of the poster is very large (\normalsize = 60pt). So when I try to add the logo code into the poster code, and the logo design uses the font sizes huge and Huge, that's based on a normalsize of 60, but the drawn circles are still 3cm across.

    Theoretically I could redo the whole thing, redrawing the circles to fit the large text, etc., but that defeats the purpose of having a logo made up.

    – crmdgn Jul 22 '17 at 01:03
  • Is the background transparent by default? Not if you convert to PNG and don't take care, of course, but the picture has a transparent background to begin with. (If your page colour is red rather than white, say., this should be pretty obvious.) Of course, if you put it on a white page, it then has a white background, just as it will have a red background, if you put it on a red page. – cfr Jul 22 '17 at 01:42
  • Please don't post examples which require proprietary fonts unless the fonts are essential to the question. – cfr Jul 22 '17 at 01:44
  • @cfr Will be more careful in future. – crmdgn Jul 22 '17 at 14:33

1 Answers1

10

The background of tikzpictures is transparent by default. Avoid filling it and it stays that way.

Here's a demonstration, with TeX fonts and images available in all standard distributions substituted for your proprietary and custom ones, which I don't have.

\begin{filecontents}{\jobname-logo.tex}
\documentclass{standalone}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{decorations.text} % Allows us to wrap text around a circle
\setmainfont{TeX Gyre Termes}
\begin{document}
\begin{tikzpicture}
  \draw [
  ultra thick,
  rotate=200,
  ] (0,0) circle (3.5cm);
  \draw [ultra thick] (0,0) circle (2.5cm);
  \path [
  decorate,
  decoration={
    raise=-1.4ex,
    text along path,
    text align={center},
    text={|\Huge|2017}
  },
  ] (180:30mm) arc (180:360:30mm) ;
  \path [rotate=224,
  decorate,
  decoration={
    raise=-4.5ex,
    text along path,
    reverse path,
    text align={fit to path},
    text={|\Huge|Look at this logo}
  }
  ] (90:35mm) arc (90:360:35mm) ;
  \node[label=above:{\huge MORE}] at (0,1) {};
  \node[label=below:{\huge WORDS}] at (0,-1) {};
  \pgftext{\includegraphics[width=3.5cm]{tiger}} at (0pt,0pt);
\end{tikzpicture}
\end{document}
\end{filecontents}

\documentclass{article}
\usepackage{xcolor,graphicx}

\begin{document}
  \pagecolor{blue}\includegraphics{\jobname-logo}
\end{document}

I compiled \jobname-logo.tex with XeTeX. You didn't say, but that's the only engine compatible with the code you posted and a current TeX installation, so I'm assuming that's what you're using. I used pdfTeX to compile the main document, because it is fastest.

The logo has a transparent background:

logo with transparent background on blue page

cfr
  • 198,882