Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm looking for a way to create subtle picture effects in beamer. I've got a few illustrations with a background that contrast offensively against a white background, and look completely out-of-place in my otherwise tamed template.

Something like the following: Soft Edges effect

For the reference, this particular effect I'm showing is called, I believe, "Soft Edges" in PowerPoint parlance.

Is that possible to do, and how?


This question is by no means restricted to beamer and this particular effect, so I will be happy to get suggestions how to do it in a general TeX document, and also other (subtle and not so subtle) effects that can be achieved.

share|improve this question
1  
I would try to create them for the image prior to inclusion in beamer... You could use the GIMP. Here's a tutorial. –  frabjous Jan 28 '11 at 14:47
    
@frabjous: Oh sure, that's probably what I will end up doing. But I was rather looking for a TeX solution, if possible. –  Martin Tapankov Jan 28 '11 at 15:05
3  
There are places where other tools are better than TeX: real picture manipulation would be one, in my opinion. –  Joseph Wright Jan 28 '11 at 16:57
    
If the mask needs to be created for each image (or at least for each image size) using something like ImageMagick, it would probably make sense to just create the transparency directly in the image in ImageMagick. But it is an interesting idea. –  Jake Jan 28 '11 at 21:21
add comment

2 Answers

I can sort of see a way to do this with pgf. However you need to (at least once) prepare a image outside of tikz/tex

\documentclass{scrartcl}

\usepackage{tikz,graphicx}


\begin{document}

\pgfimage[width=3cm,height=3cm]{1}\hskip1cm
\pgfimage[width=3cm,height=3cm]{mask.png}\hskip1cm
\pgfdeclaremask{mymask}{mask.png}
\pgfimage[mask=mymask,height=3cm,width=3cm,interpolate=false]{1}

\end{document}

1st image is the original

2nd ist the mask: black=solid, white=transparent, grey=interpolate

3rd is what you would get

enter image description here

share|improve this answer
1  
That's an interesting idea! The mask preparation is not really an issue if I can use it repeatedly, or even generate it on-the-fly with some imagemagick voodoo incantation. –  Martin Tapankov Jan 28 '11 at 16:42
    
I guess if you prepare an image that roughly is the size of your original figure it should work straight away, also I think some stretching should be possible. As you can see I did not put in an awful lot of work into my mask. Voodoo would be way over my head :) –  Martin H Jan 28 '11 at 17:10
    
If I read the pgf manual correctly, the mask has to have the same size as the image. You will have to create a separate mask for each image size that you are using. Also, it will not work on all pdf viewers. Some viewers will ignore the mask. –  Jan Hlavacek Jan 28 '11 at 20:10
add comment

I tried to create a frame using partially transparent pdf images. It sort of works, but I am having trouble getting things align correctly.

You need two pdf images, one for the corner and one for the edge. They have to be pdf, since the graphicx package does not support transparency in png images, as far as I can tell. You then use them like this:

\documentclass[]{article}
\usepackage[]{graphicx}
\newdimen\boxwidth
\newdimen\boxheight
\begin{document}
\thispagestyle{empty}
   \offinterlineskip
   \setbox0=\hbox{\includegraphics{rnahu.png}}
   \boxwidth=\wd0
   \boxheight=\ht0
   \advance\boxwidth by -20pt
   \advance\boxheight by -21pt
   \leavevmode\hbox{\rlap{\box0}\vbox{%
   \hbox{%
   \kern-.5pt\includegraphics[width=11pt,height=11pt]{corner.pdf}%
   \kern-.5pt\includegraphics[width=\boxwidth,height=11pt]{edge.pdf}%
   \kern-.5pt    \includegraphics[width=11pt,height=11pt,angle=270,origin=cc{corner.pdf}}%
   \vskip-.5pt%
   \hbox{%
   \kern-.5pt\includegraphics[width=\boxheight,height=11pt,angle=90,origin=cc]{edge.pdf}%
   \kern-.5pt\hspace{\boxwidth}%
   \kern-.5pt\includegraphics[width=\boxheight,height=11pt,angle=270,origin=cc]{edge.pdf}}%
   \vskip-.5pt%
   \hbox{%
   \kern-.5pt\includegraphics[width=11pt,height=11pt,angle=90,origin=cc]{corner.pdf}%
   \kern-.5pt\includegraphics[width=\boxwidth,height=10pt,angle=180,origin=cc]{edge.pdf}%
   \kern-.5pt\includegraphics[width=11pt,height=11pt,angle=180,origin=cc]{corner.pdf}}%
   \vskip-.5pt%
   }%
   }
\end{document}

The kerns and vskips are there to get things to align, and the values were determined by experimenting. You can see on the image that it is still far from perfect. image with softened edges

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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