Re: Graphicx TeXnicians: Best way to find finished size of included graphic?




<daveandes@xxxxxxxxxxx> wrote in message
news:1138653227.443585.294660@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm hoping someone might help me find a (relatively) easy solution to a
big graphicx problem!

>I'm wondering if there's a decent way to figure out what size the
>graphic is _before_ calling \includegraphics. I envision a macro, maybe
>called \getgraphicsize, that would read the file and get its size.
>Optionally, it would provide the finished size after transformations
>when called with optional parameters; i.e.
>\getgraphicsize[scale=0.8]{mygraphic}. Then I could use the dimensions
>to somehow select which environment I want to call.
>
>Thanks for any suggestions you might have...
>
>David

hi,

This is what I would do:
\newsavebox{\graphbox}
\savebox{\graphbox}{\includegraphics[scale=.75]{filename}}
and then use \ifthenelse with \wd\graphbox to decide on which
of your environments to use.

btw, you can then \usebox since you've already loaded your graphic.

--Tim Arnold


.



Relevant Pages