36

I am trying to embed an image with a transparent background in my LaTeX poster. However a quick google search has taught me that it is not possible to do so. However I intend to know any clever workarounds as I believe LaTeX is frequently used for making scientific posters, which require inclusion of transparent images.

Exact problem. I am trying to include a logo (with transparent background) in a textbox with gradient fill. Any method to accomplish this without getting a white (or any other) background is appreciated.

My current work around is the brute force technique of copying the gradient pattern in the background of the image.

2
  • 1
    For posters in general I would recommend beamerposter. May 20, 2011 at 14:04
  • Welcome to TeX.sx! Your question was migrated here from another stackexchange site. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question.
    – N.N.
    Aug 13, 2011 at 13:32

3 Answers 3

34

Your Google source is wrong. The PDF version of LaTeX pdflatex supports the PNG format out of the box, including transparent PNGs. If you have your logo in another format like GIF than simply convert it to PNG first. I would not recommend to use the normal latex compiler with DVI output.

You need the standard package graphicx to include the image. Loaded xcolor would also be a good idea. Here some examples which use a transparent test PNG I got from http://entropymine.com/jason/testbed/pngtrans/rgba16.png.

\documentclass{article}

\usepackage{xcolor}
\usepackage{graphicx}

\begin{document}

\framebox{\includegraphics{rgba16.png}}
\colorbox{red}{\includegraphics{rgba16.png}}
\colorbox{white}{\includegraphics{rgba16.png}}
\colorbox{yellow}{\includegraphics{rgba16.png}}

\end{document}

The first image shown is the original transparent PNG. As you can see the other work fine with some background color.

Result 1

For advanced effects like patterns and shadings I would recommend you PGF/TikZ (i.e. the tikz package).

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{tikzpicture}
    \node [pattern=north east lines,inner sep=10pt] {\includegraphics{rgba16.png}};
\end{tikzpicture}
\begin{tikzpicture}
    \node [shade,left color=yellow,right color=blue,inner sep=10pt] {\includegraphics{rgba16.png}};
\end{tikzpicture}
\end{document}

Result 2

2
16

it is simple for an eps image:

\documentclass{minimal}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{pst-node,graphicx}
\SpecialCoor
\begin{document}
\noindent\pnode(0.5\textwidth,-0.5\textheight){Center}
\blindtext[6]
\rput(Center){\special{ps: 0.4 .setopacityalpha}\includegraphics[width=\textwidth]{tiger.eps}}

\end{document}

enter image description here

3
  • 1
    This did not work for me: look.
    – Hans
    Feb 27, 2015 at 14:47
  • "Did not work" is not a usefull error description.
    – user2478
    Mar 1, 2015 at 7:09
  • 2
    I'm sorry, I sent you a link with the problem. Anyway: it doesn't show transparent to me, is completely solid, the opacity does not work for me. Within the link is the minimal example (even though it is basically the same as what you have, just changing the image).
    – Hans
    Mar 1, 2015 at 13:58
8

pdflatex with graphicx-package and/or PGF is able to include PNG or certainly PDF, both can have transparent backgrounds.

If you have to use latex with dvi2ps or something like that try it wit an EPS image.

2
  • 1
    I am having a lot of trouble including PDFs with transparency (no problems with PNGs). I can't find much about the topic and you seem like you have it working. Do you have to do anything special to get transparent PDFs to get included properly?
    – vlsd
    May 10, 2012 at 1:27
  • 1
    @VladSeghete: Until now I only used PDFs with transparent (not semi transparent something between opaque and transparent) parts without any problems, but I know that semi transparencies can cause problems … Sorry that I can’t help better.
    – Tobi
    May 10, 2012 at 8:32

You must log in to answer this question.