Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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[""];
c2 = Import[""];
(* 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:


(* 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
up vote 22 down vote accepted

What you're looking for is ImageAssemble:

c1 = Import[""];
c2 = Import[""];
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

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

Your Answer


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.