Szabolcs
Szabolcs

Reputation: 25703

Forcing images to be displayed at actual size in Mathematica

When right clicking an Image in the front end, there's the option to display at its actual size (i.e. 1:1 screen to image pixel size).

How can images be forced to be shown like this? When making a Row or Column of Images, how can they be made to display at their actual size?

I was comparing image resampling methods to see which one gives the best result for a sharp edges when this came up. As a workaround I ImageAssembled all the images, so I had to right-click only once to get them to display at actual size.

Upvotes: 5

Views: 733

Answers (3)

Mr.Wizard
Mr.Wizard

Reputation: 24336

Here is another method that works on version 7 at least.

img = ExampleData[{"TestImage", "Lena"}];

Row[{ Image[img, Magnification -> 1], Image[img, Magnification -> 1] }]

Upvotes: 6

Sjoerd C. de Vries
Sjoerd C. de Vries

Reputation: 16232

I only became aware of this context menu item a couple of months ago. It was probably added somewhere in v8.

I noticed Image-like output gets this item in their context menu, but bitmaps from Rasterize don't. You may try Rasterize[Plot[Sin[x], {x, -\[Pi], \[Pi]}], RasterSize -> 500] to test that. Put // Image behind it and you get a different context menu for the result.

I believe the presence of ImageSize in the containing Cell determine the scaling of images (of the second kind). No ImageSize means automatic scaling and ImageSize->Magnification[1] means actual size. So, you would need to manipulate the cell itself to change the behaviour.

Upvotes: 3

Mr.Wizard
Mr.Wizard

Reputation: 24336

Please try:

Show[image, ImageSize -> All]

Likewise:

Row[{ Show[img1, ImageSize -> All], Show[img1, ImageSize -> All] }]

Upvotes: 1

Related Questions