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.

I have the following images, both 480 x 270 pixels:

AquaSilk (Zangief) vs EMP EvilRahsaan (Blanka) - capture 1

AquaSilk (Zangief) vs EMP EvilRahsaan (Gen) - capture 2

I'd like to stitch them side by side in a 960 x 270 pixel image like so (scaled down):

images side-by-side

So far, I've been using GraphicsGrid to try to achieve this:

c1 = Import["http://i.stack.imgur.com/2SRcD.png"];
c2 = Import["http://i.stack.imgur.com/zL8id.png"];
(* Frame parameter set here to emphasize next point. *)
g = GraphicsGrid[{{c1, c2}}, Frame -> True]

But there's padding between the images:

GraphicsGrid call with c1 and c2

Additionally, it's scaled incorrectly, as ImageDimensions shows:

ImageDimensions@g

(* Expect {960, 540} *)
{360, 180}

I can use the ImageSize parameter to explicitly set the size of the output image, but that just reproduces the above result to scale.

How can combine the images side-by-side without scaling or padding?

share|improve this question
    
My proxy/firewall won't let me Import the pictures, but isn't this a job for ImagePadding->None? –  Verbeia Jan 19 '12 at 3:47
    
@Verbeia ImagePadding -> None actually masks the entire image with a thick white border all around, cropping the images in half with the parts along the vertical center being exposed. –  casperOne Jan 19 '12 at 3:50
    
Try Grid instead of GraphicsGrid. I'm at work now so I can't really pursue this now, but GraphicsGrid enforces equal column widths, so this might be causing a problem. ImageAssemble is the neatest solution, but there are others. –  Verbeia Jan 19 '12 at 3:55
add comment

2 Answers 2

up vote 19 down vote accepted

What you're looking for is ImageAssemble:

c1 = Import["http://i.stack.imgur.com/2SRcD.png"];
c2 = Import["http://i.stack.imgur.com/zL8id.png"];
ImageAssemble[{c1, c2}]

Mathematica graphic

It can also assemble vertically and horizontally:

ImageAssemble[{{c1, c1}, {c2, c2}}]

Mathematica graphic

share|improve this answer
    
As well as fleshing out the answer, I'm actually doing the 4x4, but displaying the NxN case is the best answer overall. –  casperOne Jan 19 '12 at 3:48
add comment

Incidentally, ImageDimensions on GraphicsGrid is behaving correctly. GraphicsGrid is generating an object with head Graphics, with a default width of 360 points, and the contents scaled down to fit. ImageDimensions then creates a bitmap version of the graphic, maintaining the size on screen, and returns the dimensions for that.

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.