16

Is there a way to find the numeric equivalents of Tiny, Small, Medium, and Large for for ImageSize? In other words, what are the integers t, s, m, and l such that, for Graphics objects, the directives

ImageSize -> t
ImageSize -> s
ImageSize -> m
ImageSize -> l

are equivalent, respectively, to the directives

ImageSize -> Tiny
ImageSize -> Small
ImageSize -> Medium
ImageSize -> Large

?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
kjo
  • 11,717
  • 1
  • 30
  • 89
  • I think they produce the same result for all graphics but I'm not sure, but if that's the case: imgs = Graphics[Rectangle[{1, 1}], ImageSize -> #] & /@ {Tiny, Small, Medium, Large} and then ImageDimensions /@ imgs – C. E. Sep 05 '13 at 17:32
  • 2
    Depends on a case: Slider[.5, ImageSize -> Tiny] // Rasterize // ImageDimensions – Vitaliy Kaurov Sep 05 '13 at 17:37
  • 2
    Good point @Vitaliy, I assumed we're talking about Graphics. kjo, can you update your question and specify whether you're talking only about graphics or all situations? – Szabolcs Sep 05 '13 at 17:41
  • @Szabolcs: done (yes, I was referring to Graphics only) – kjo Sep 05 '13 at 18:06

1 Answers1

15

You can obtain the sizes like this:

In[1]:= Rasterize[Graphics[{}, ImageSize -> #], "RasterSize"] & /@ {Tiny, Small, Medium, Large}

Out[1]= {{100, 100}, {180, 180}, {360, 359}, {576, 575}}

It is the horizontal size that is relevant. The vertical size will depend on the aspect ratio. Thus ImageSize -> Medium corresponds to ImageSize -> 360.

A warning: In some cases Tiny, Small, etc. do not directly correspond to numerical values, and their effect depends on the context. I do not know if this is the case for ImageSize or not (I could imagine it might depend on the screen DPI setting, but then it might not.) I'm just warning you. (An example where this happens is Arrowheads, where using numerical values causes the arrow to scale with the graphic, while using e.g. Large makes the arrow size independent of the image size.)


Edit by István:

Below is a comprehensive list of possible ImageSize specifications for various objects, with default settings:

spec = {Tiny, Small, Medium, Large, All, None, Full, 
        Automatic, {Large, Automatic}, {{Tiny}, {Medium}},
        100, {100, 100}, Scaled@.6};

Panel@TableForm[{
   Rasterize[Graphics[{}, ImageSize -> #], "RasterSize"] & /@ spec,
   Rasterize[Graphics3D[{}, ImageSize -> #], "RasterSize"] & /@ spec,
   Rasterize[Plot[x, {x, 0, 1}, ImageSize -> #], "RasterSize"] & /@ spec,
   Rasterize[Slider[x, {0, 1}, ImageSize -> #], "RasterSize"] & /@ spec,
   Rasterize[Quiet@Pane["x", ImageSize -> #], "RasterSize"] & /@ spec
   } // Transpose, 
 TableHeadings -> {spec, {Graphics, Graphics3D, Plot, Slider, Pane}}, 
 TableDepth -> 2]

enter image description here

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263