MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Aspect Ratio

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95045] Re: [mg94997] Re: [mg94985] Aspect Ratio
  • From: "Nathan Myhrvold" <nathanm at intven.com>
  • Date: Sun, 4 Jan 2009 07:33:11 -0500 (EST)
  • References: <200901020129.UAA23788@smc.vnet.net> <op.um3xtmkrtgfoz2@bobbys-imac.local> <200901020334.WAA25512@smc.vnet.net> <2EDC2F38-B525-418C-9EA0-F832BB10CE24@wolfram.com>

Thanks - this seems to work well for graphics (but is a bit slow).

Nathan

This message and any attachments, may contain confidential and/or 
legally privileged information.  If you are not the intended recipient 
of the message by the original sender, please destroy it.   Message 
and attachments copyright =A9 2008, all rights reserved.  Any 
unauthorized dissemination, distribution or copying is strictly 
forbidden


-----Original Message-----
From: Brett Champion [mailto:brettc at wolfram.com]
Sent: Thursday, January 01, 2009 8:14 PM
To: Nathan Myhrvold
Cc: mathgroup at smc.vnet.net
Subject: [mg95045] Re: [mg94997] Re: [mg94985] Aspect Ratio

On Jan 1, 2009, at 9:34 PM , Nathan Myhrvold wrote:

> Thanks!  I was hoping that this would work for arbitrary graphics -
> including Text[] in various fonts.  I will try it.
>
> My goal here is that I want to use Inset[] to compose various 2D and 
> 3D
> graphics together.
>

You can (in V7, at least) also use Rasterize[.., "RasterSize"], 
although you have to be careful about the various XXXPadding options 
to Graphics.

In[130]:= r1 = Graphics[Rectangle[{0, 0}, {1, 10}]];

In[131]:= r2 = Graphics[Rectangle[{0, 0}, {1, 2}]];

In[132]:= Rasterize[r1, "RasterSize"]

Out[132]= {46, 432}

In[133]:= Rasterize[Show[r1, ImagePadding -> 0, PlotRangePadding -> 
0], "RasterSize"]

Out[133]= {43, 432}

In[134]:= Rasterize[Show[r2, ImagePadding -> 0, PlotRangePadding -> 
0], "RasterSize"]

Out[134]= {216, 432}

This should generally be more robust than most other methods I can 
think of, though a bit slower than some other methods, since it has to 
ask the frontend for information about the rendered result instead of 
using information available to the kernel.  The kernel has no idea 
about things like font metrics and so this is probably a better 
approach if you're interested in (styled) text.

Brett Champion
Wolfram Research


  • Prev by Date: Re: sector-based analysis using FInancialData[]
  • Next by Date: Re: Re: Graph of some built-in functions blows up Mathematica V7
  • Previous by thread: Re: Re: Aspect Ratio
  • Next by thread: Re: Non-deterministic numerical inaccuracies in Mathematica 7