Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 841
Szabolcs Avatar asked Nov 20 '11 11:11

Szabolcs


2 Answers

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

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

Row[{ Image[img, Magnification -> 1], Image[img, Magnification -> 1] }]
like image 180
Mr.Wizard Avatar answered Oct 14 '22 09:10

Mr.Wizard


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.

like image 3
Sjoerd C. de Vries Avatar answered Oct 14 '22 10:10

Sjoerd C. de Vries