6
$\begingroup$

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

$\endgroup$
3
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thanks! Could you explain a little more about how you dig it out? $\endgroup$ – xslittlegrass Sep 8 '14 at 0:41
  • $\begingroup$ @xslittlegrass, I used my spelunking tool from this question. $\endgroup$ – Simon Woods Sep 8 '14 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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