Re: Re: Aspect Ratio
- To: mathgroup at smc.vnet.net
- Subject: [mg94999] Re: [mg94997] Re: [mg94985] Aspect Ratio
- From: Brett Champion <brettc at wolfram.com>
- Date: Fri, 2 Jan 2009 06:54:34 -0500 (EST)
- References: <200901020129.UAA23788@smc.vnet.net> <op.um3xtmkrtgfoz2@bobbys-imac.local> <200901020334.WAA25512@smc.vnet.net>
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
- References:
- Aspect Ratio
- From: "Nathan Myhrvold" <nathanm@intven.com>
- Re: Aspect Ratio
- From: "Nathan Myhrvold" <nathanm@intven.com>
- Aspect Ratio