Reputation: 1672
I've been having trouble arranging graphic elements correctly. Here's an example:
im1 = Import["http://upload.wikimedia.org/wikipedia/commons/5/5c/London_2010_Tower_Bridge.jpg"];
GraphicsRow[{im1, ImageAdd[im1, Graphics[Disk[]]], Graphics[Disk[]]}]
The circles are both specified in the same way, but show at different scales, so the diagram that attempts to show how it works isn't very satisfactory. Obviously one is scaled to match the image, but I can't see why they don't appear the same size. Row
is similar to GraphicsRow
but gives me the same problem.
Upvotes: 8
Views: 3122
Reputation: 24420
Another option would be to wrap the images in a Pane
with automatic width and fixed height, e.g.
Row[Pane[#, {Automatic, 200}] & /@
{im1, ImageAdd[im1, Graphics[Disk[]]], Graphics[Disk[]]}]
Upvotes: 8
Reputation: 1683
There is padding around the images and none around the black disk. By knowing the aspect ratio of the imported image (obtained from ImageDimensions), and by setting a specific size for GraphicsRow and for the the black disk, you can control the appearance:
GraphicsRow[{im1, ImageAdd[im1, Graphics[Disk[]]],
Graphics[Disk[], ImageSize -> 90, ImagePadding -> 15]},
ImageSize -> 360, Spacings -> 0]
Upvotes: 5
Reputation: 42235
The problem occurs because in the display, the disk used in the mask has a diameter equal to the height of the image, whereas the stand-alone disk has a diameter equal to the width of the image. You can correct this by specifying the size of the disk explicitly.
im1 = Import[
"http://upload.wikimedia.org/wikipedia/commons/5/5c/London_2010_\
Tower_Bridge.jpg"];
disk = Graphics[Disk[], ImageSize -> ImageDimensions@im1];
GraphicsRow[{im1, ImageAdd[im1, disk], disk}, Spacings -> 0, ImageSize -> Full]
Upvotes: 10