Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Right click on an output image, choose magnification. There are 25%, 50%, 100% etc. But how can I set to 75%?

share|improve this question
    
add comment

4 Answers

up vote 4 down vote accepted

I do not know how to do it using the menu, since this setting is not there. But you always use the Magnify command?

 r=Image[ {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}}]

Mathematica graphics

r15 = Magnify[r, 1.5]

Mathematica graphics

r75 = Magnify[r, .75]

Mathematica graphics

r75  (*showing that new image will keep new magnification*)

Mathematica graphics

share|improve this answer
    
Thanks, but when I copy magnified image to another ranotebook, it restores its original size. So strange. –  zhangwfjh Jan 8 at 7:54
    
Really? I tried, but failed. You will find that dimension of image doesn't change. –  zhangwfjh Jan 8 at 7:58
    
OIC. Maybe my paste mode is wrong. Thanks. –  zhangwfjh Jan 8 at 8:13
add comment

I voted for both prior answers, each of which demonstrates a method to change the magnification of a graphical object. However, only the Image Option Magnification persists when the image is copied. This is because using Magnify sets the Magnification option in a StyleBox when it is rendered:

rose = Import["ExampleData/rose.gif"];

Magnify[rose, 0.75] // ToBoxes // Rest
StyleBox[Magnification -> 0.75 Inherited, StripOnInput -> False]

If you copy-and-paste the entire output Cell this StyleBox is preserved, but not if you copy only the image. Similarly using Style, except that when using Magnify the coefficient Inherited is used which makes total magnification cumulative rather than absolute:

Style[rose, Magnification -> 0.75] // ToBoxes // Rest
StyleBox[Magnification -> 0.75, StripOnInput -> False]

When the option set in Image is rendered it appears in the GraphicsBox which is preserved even when the image alone is copied:

Image[rose, Magnification -> 0.75] // ToBoxes // Rest
GraphicsBox[BaseStyle -> "ImageGraphics", ImageSize -> Magnification[0.75], 
 ImageSizeRaw -> {223, 164}, PlotRange -> {{0, 223}, {0, 164}}]

An equivalent method (for Images) is to use Show rather than Image:

Show[rose, Magnification -> 0.75] // ToBoxes // Rest
GraphicsBox[BaseStyle -> "ImageGraphics", ImageSize -> Magnification[0.75], 
 ImageSizeRaw -> {223, 164}, PlotRange -> {{0, 223}, {0, 164}}]

This has the advantage however of not rasterizing Graphics objects, so it is more general and less destructive:

gr = Plot[Sinc[x], {x, 0, 10}];

Image[gr, Magnification -> 0.75] // Head
Show[gr, Magnification -> 0.75]  // Head
Image

Graphics

Please also see my answer to How do I display imported images at actual size? for examples of the way the options ImageSize and Magnification interact.

share|improve this answer
add comment

You might do as follows. Let us take the example image from Help:

rose = Import["ExampleData/rose.gif"]

It is an image:

rose // Head

(* Image *)

Now the construct

Image[rose, Magnification -> 0.75]

gives you the expected. Compare:

{Image[rose, Magnification -> 1], Image[rose, Magnification -> 0.75]}

Should look as follows:

enter image description here Here the first two roses represent the output of the line above, while the third rose is the result of the copy-paste of the 75%-sized one in another notebook. So its size stays 75% of the original as we see.

share|improve this answer
add comment

There is a difference between resizing an image and resizing the display of the image. Consider:

r = Image[{{0, 1, 0}, {1, 0, 1}, {0, 1, 0}}];
r100 = ImageResize[r, 100];
rNot100 = Image[r, ImageSize -> 100];
rmag = Image[r, Magnification -> 33.3]

All three of the resized images r100, rNot100 and rmag look the same:

enter image description here

But if we check on the actual dimensions:

ImageDimensions /@ {r, r100, rNot100, rmag}
{{3, 3}, {100, 100}, {3, 3}, {3, 3}}

we can see that ImageResize changes the number of pixels in the underlying data while ImageSize and Magnification only change the displayed image. Which one you want will depend on what your goal is.

share|improve this answer
add comment

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.