13
$\begingroup$

What is responsible for the middle Row images' size? And why single image row is different?

{#, Row[{#, #}], Row[{#}]} & @ RandomImage[1, {100, 100}]

enter image description here

I know I can prevent that with mapping with Pane but I would like to have more understanding about what happens.

I thought it is related to some styles but I haven't found anything related in Core.nb under ImageGraphics or RowDefault styles.

There are related options like ImageSizeAction or ImageSizeMultipliers but I've failed to find connection with the case.


It doesn't seem predictable, since here overall size is larger yet nothing is resized:

{#, Row[{#, #, #, #, #}], Row[{#}]} &@RandomImage[1, {50, 100}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Related questions for background: (8583), (39996), (72573) $\endgroup$
    – Mr.Wizard
    Feb 12, 2016 at 23:41
  • $\begingroup$ I have looked everywhere I can think of and I found nothing. This may be deeply embedded in the system. $\endgroup$
    – Mr.Wizard
    Feb 13, 2016 at 0:08

1 Answer 1

10
$\begingroup$

There are two distinctions to be made here. Both Row and List will resize graphics objects if they are above a certain threshold size, and that threshold size is different.

List

List will resize a graphics object when its width is larger than 180 pixels, and then further reduce its size if the width is over 360

Manipulate[Labeled[
  {RandomImage[1, {n, 200}]},
  "Width = " <> IntegerString[n]], {{n, 50}, 50, 1000, 1}, 
  ContentSize -> {300, 400}]

enter image description here

A similar effect is seen with the height with a threshold value of 430 pixels,

Manipulate[Labeled[
  {RandomImage[1, {200, n}]},
  "Height = " <> IntegerString[n]], {{n, 50}, 50, 1000, 1}, 
 ContentSize -> {300, 400}]

enter image description here

Row

Unlike List, Row will not resize a graphic if it is the only element in the list,

Row[{RandomImage[1, {300, 200}]}]
Row[{RandomImage[1, {500, 200}]}]

enter image description here

But it will resize if there is more than one element in the list,

Manipulate[
  Labeled[
   Row[{#, , #, , #, , #}] &@RandomImage[1, {n, 200}],
   "Width = " <> IntegerString[n]]
  , {{n, 50}, 50, 1000, 1}, ContentSize -> {500, 250}]

enter image description here

Things get even more complicated when you combine the two functions, such that you have Row objects inside the List along with other graphics

Manipulate[
 Labeled[
  {#, Row[{#, , #, , #, , #}]} &@RandomImage[1, {n, 200}],
  "Width = " <> IntegerString[n]]
 , {{n, 50}, 50, 1000, 1}, ContentSize -> {500, 250}]

enter image description here

So there appears to be some kind of rhyme and reason to it, but it'd take a bit more work like this to exactly nail down when it is doing this and why.

$\endgroup$
3
  • $\begingroup$ List[graphics] will resize the graphics if it is larger than a threshold value, but Row[List[graphics]] will not. However, Row[List[graphics,graphics]] will resize the graphics. I don't pretend to understand why these rules are in place, I just poke it in different ways to see how it responds, and it is predictable. $\endgroup$
    – Jason B.
    Feb 12, 2016 at 9:39
  • 3
    $\begingroup$ FrontEnd uses the ImageSizeMultipliers option settings to determine the size of the resized image. Wrap the images with Style[..., ImageSizeMultipliers -> {1, 1}] to disable resizing. $\endgroup$ Feb 12, 2016 at 10:42
  • 3
    $\begingroup$ Disabling the resizing is easy enough to do - another way is to give an ImageSize option to each Graphics. But I feel like the question here is to figure out the resizing, why and when it happens. $\endgroup$
    – Jason B.
    Feb 12, 2016 at 11:44

Your Answer

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

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