6

Am I missing something or this is a bug? Why I get different results by just adding a bracket?

g1 = Graphics[{}, ImageSize -> {200, Automatic}, AspectRatio -> 2];
g2 = Graphics[Rectangle[], ImageSize -> {200, Automatic}, AspectRatio -> 1];
g3 = Graphics[Rectangle[], {ImageSize -> {200, Automatic}, AspectRatio -> 1}];

Row[{
ImageCompose[g1, g2, {0, 0}, {0, 0}],
ImageCompose[g1, g3, {0, 0}, {0, 0}],
ImageCompose[g1, Show[g2], {0, 0}, {0, 0}]}]

enter image description here

xslittlegrass
  • 27,549
  • 9
  • 97
  • 186

1 Answers1

3

The discrepancy arises inside the function Image`CompositionOperationsDump`imvQ in which the ImageSize option value for the graphics is extracted using:

rdims = Cases[i, rul_Rule /; First[rul] === ImageSize];

Since there is no explicit level specification in the Cases it defaults to {1} and therefore when the ImageSize option is at a deeper level (as in your g3) it doesn't get picked up.

It's not clear to me why the code uses Cases here, rather than Options, so I am not sure if this is a bug or a deliberate choice.

Simon Woods
  • 84,945
  • 8
  • 175
  • 324