TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically I want to use a TikZ node to frame a pgfimage, so later on, I will add more and connect them as I see fit. I have this:

  \node (MM) [rectangle,draw,thick,minimum width=10.15em,label=below:Description]{\pgfbox[center,center]{\pgfuseimage{image1}}};

So now I need to get the height of image1 to add minimum height property in the node declaration. This way I can get a dynamic framing independent of the aspect ratio of the image. Maybe it's an easy task but I'm newbie to this and can't seem to find the information I need in the documentation.

share|improve this question
Welcome to TeX.sx! Why don’t you set greater inner xsep and inner ysep values instead of using minimum width and minimum height? – Qrrbrbirlbel Mar 5 '13 at 18:23
thanks for the reply, but with that I have the same problem. I don't know to which value I should set the inner ysep, since depending on the aspect ratio, it will vary (I'm only fixing width=10em), I could manually adjust it but in the future I want to put more images in an automated way. – Marco Martins Mar 5 '13 at 19:17
up vote 3 down vote accepted

\pgfdeclareimage does not use or measure the image, but you can get the height by using LaTeX's \settoheight:




  \node (MM) [
    minimum width=10.15em,
    minimum height=\the\dimexpr\imageheight+.15em\relax,

share|improve this answer
thanks, worked like a charm ;) – Marco Martins Mar 5 '13 at 20:19

Your Answer


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.