The title pretty much says it all.

One possible point of confusion is that this question is not limited to items with head Image.

I don't know what is the official terminology for what I'm referring to, but I can describe it operationally: if I click on a "graphic-type" (Graphics, Graphics3D, Image, etc.) thingie being displayed by the front end, usually1 an orange outline appears around it, featuring "drag handles" at its corners and mid-sides. My question here is: how can I get the current, actual image size of such a thing?

Also, I'm not interested in ways to answer this question that rely on deducing this size from knowledge of the default behaviors of the code that produced the output. Rather, I'm looking for a method that somehow interrogates the actual item shown on the screen.

1 One exception is the output of, say, GraphicsGrid, which, depending on where one clicks on it, can get a thick gray outline around the whole grid, or an orange outline around the content of an individual cell.

  • 4
    $\begingroup$ Does the function Predictions`getImageSize give what you need? $\endgroup$
    – kglr
    Jun 27, 2015 at 21:26
  • $\begingroup$ @kglr: Marvelous. Thanks! $\endgroup$
    – kjo
    Jun 27, 2015 at 22:44
  • 1
    $\begingroup$ Note that Predictions`getImageSize[graphic] is equivalent to well-documented Rasterize[graphic, "RasterSize"] (as can be found by looking at the Definition of Predictions`getImageSize). $\endgroup$ Jun 28, 2015 at 5:22
  • $\begingroup$ I notice that PredictionsgetImageSize` won't work if Suggestions Bar is disabled. $\endgroup$
    – SquareOne
    Jun 28, 2015 at 8:18

1 Answer 1


kglr's very useful trophy from the land of undocumented functions needs to be recorded.

Suppose you have the following plot:

Plot[Sin[2 Pi t], {t, 0, 1}, ImageSize -> Tiny]


Then you can just cut and paste


{100, 54}

Note, however, that Predictions`getImageSize actually reports ImageSize plus ImageMargins, as shown in the listing below. (The following abbreviations are used in the headings: Pred`gIS= reported by Predictions`getImageSize; IS= specified ImageSize; PRP= specified PlotRangePadding; IP= specified ImagePadding; IM=specified ImageMargins; the ImageSize was adjusted as necessary so as to keep the size of the plotted function graph invariant.)

Mathematica graphics

FWIW, here's the code that generated the listing above.

example[size_, prPadding_, padding_, margins_] := Module[{plot},
   plot = 
    Plot[Sin[2 Pi t], {t, 0, 1}, Frame -> True, 
     Background -> LightBlue, PlotRangePadding -> prPadding, 
     ImagePadding -> padding, ImageMargins -> margins, 
     ImageSize -> size];
   {Predictions`getImageSize[plot], plot, size, prPadding, padding, 

Grid[Join[{{"Pred`gIS", "Sin[2 Pi t]", "IS", "PRP", "IP", "IM"}},
  example @@@ 
    {100,          0,            0,  0},
    {100/0.8,      Scaled[0.1],  0,  0},
    {60 + 100/0.8, Scaled[0.1], 30,  0},
    {60 + 100/0.8, Scaled[0.1], 30, 15}
 Alignment -> Left, 
 Dividers -> {All, {True, True, False, False, False, True}}, 
 Spacings -> {2, 2}]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.