Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
    
Related questions for background: (8583), (39996), (72573) – Mr.Wizard Feb 12 at 23:41
    
I have looked everywhere I can think of and I found nothing. This may be deeply embedded in the system. – Mr.Wizard Feb 13 at 0:08

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.

share|improve this answer
    
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. – Jason is no longer a postdoc Feb 12 at 9:39
3  
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. – Alexey Popkov Feb 12 at 10:42
3  
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. – Jason is no longer a postdoc Feb 12 at 11:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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