I've pasted a large number of photos and they are too big which makes scrolling hard. Is there a way to automatically have Mathematica size them to 10% or something reasonable without have to click on each on individually?


You can put it to the last cell and evaluate, it will resize all images from InputCells to the width of 100px.

You can of course change affected cell set and output parameters.

 With[{nr = NotebookRead[cell]},
  If[! FreeQ[nr, "ImageGraphics"],

   SelectionMove[cell, Cell, All];
   NotebookWrite[ EvaluationNotebook[],
                  nr /.  g : GraphicsBox[__, BaseStyle -> "ImageGraphics", ___] :> 
                     ToBoxes@ImageResize[ToExpression[g], 100]

 , {cell, Most@Cells[CellStyle -> "Input"]}
| improve this answer | |
  • $\begingroup$ Your programmatic solution works great Kuba. Are you sure, there isn't a manual way to resize multiple graphic outputs in a similar fashion as "shift" /"cmd" click in other programs. Quite often I lack this functionality, especially with lists of graphics/plots. $\endgroup$ – MathLind Jun 28 '16 at 14:14
  • 1
    $\begingroup$ @MathLind I'm not sure but I'm not aware of any :) But that's what palettes are for, to customize/add features. So you can use it from a palette's button (after changing EvaluationNotebook[] and Cells[] appropriately. I can add that code later. $\endgroup$ – Kuba Jun 28 '16 at 14:36

This answer is an addition to the excellent answer by Kuba that uses ImageResize and hence operates on the Notebook in a destructive way with loss of the original image data. Here is a modification of that solution which works non-destructively and simply sets widths for all images in the "Input" Cells equal to 100:

Do[With[{nr = NotebookRead[cell]}, 
  If[! FreeQ[nr, "ImageGraphics"], SelectionMove[cell, Cell, All];
    nr /. g : GraphicsBox[__, BaseStyle -> "ImageGraphics", ___] :> 
      Append[DeleteCases[g, ImageSize -> _], ImageSize -> {100, Automatic}]];]], {cell, 
| improve this answer | |

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.