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.

Within a TikZ drawing, I want to distort a 2D rasterimage (from \includegraphics) so that it appears to be rotated by 90° around the vertical axis in 3D (it should look perpendicular to the sheet of paper). I've managed to achieve a transformation with yslant and xscale, like the following.

\begin{tikzpicture}
  \node (term) at (0,0) [yslant=-0.7,xscale=0.3] 
        {\includegraphics[width=40mm]{image.png}};
\end{tikzpicture}

which distorts an image like this

                            a    
                            |\             
a---------b                 | \  
|         |                 |  \ 
|         |      -->        c   b
|         |                  \  |
c---------d                   \ |
                               \|
                                d

I'm not really happy with this: The distance |a-c| should be smaller than |b-d|. How can I achieve this?

There is an example of a cuboid which looks pretty nice, but it seems useless to distort an imported raster image.

share|improve this question
    
Welcome to TeX.sx! No need to add signature, your username is included in the lower right of your Q. –  Peter Jansson Jan 28 '13 at 23:42
1  
The transformation you achieved would be the result of a parallel projection. You actually want to simulate a perspective projection? I don’t think this is doable with vanilla TikZ options. You probably need to calculate these transformations. –  Qrrbrbirlbel Jan 28 '13 at 23:46
    
This is not doable via PDF transformation (TikZ and PGF use PDF transformations). You need to transform your rasterimage via Gimp (or Photoshop). –  Paul Gaborit Jan 29 '13 at 0:13
    
Maybe a duplicate : tex.stackexchange.com/questions/52578/perspective-transform ? Nope you have an image, nevermind –  percusse Jan 29 '13 at 0:32
1  
I think this is best done with ImageMagick’s convert tool. Using example-image.png from the mwe package one can do convert example-image.png -distort Perspective "0,0,0,40 0,300,0,260 400,0,400,0 400,300,400,300" example-image-distorted.png. Though, I couldn’t get the now black background color to be either white or transparent. I’m sure, it is somehow possible. –  Qrrbrbirlbel Apr 9 '13 at 17:02
show 1 more comment

closed as too localized by Qrrbrbirlbel, Heiko Oberdiek, Kurt, Xavier, Tom Bombadil Jun 10 '13 at 4:40

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.