17

I've recently drawn 2 images and for the final product I need to combine half of each images, one on the left and one on the right, into a single image.

26

My answer is very much like the previous answer. I still provide it because the above did not directly lead to success. So you have two files: file1.jpeg and file2.jpeg. They can be different formats than jpeg, and they do not need both to have the same format. So file2.png would be fine too. As a matter of background you can think of the Gimp image as a number of layers over a canvas. The idea is to extend the canvas, add the second image as a layer. Next move the layers so that they do not overlap.

  • Open file1.jpeg using Gimp.
  • Save file1.jpeg in the native Gimp format. Say we save it to file1.xcf.
  • Expand the canvas. Go to the menu Image, next Canvas size. You can now expand the canvas in the direction you like. Make sure there is enough space for both file1 and file2. If afterwards it turns out the canvas was not big enough you can always make it bigger so that both images fit. One option would be to check the images x dimension in terms of pixels and expand by that much in the direction required.
  • Next choose Windows , then Dockable Dialogs, then Layers. This shows the layers dialog. If all is well you have one layer. It is file1.
  • Now choose File, Open as Layers and open file2.jpeg.

At this point you see two layers in the Layers dialog. The image itself has become quite messy with the two images overlapping. One is file1 and the other file2. You now want to move these layers so that they no longer overlap.

  • Choose View, and select snap to canvas edges, that way you can align the images correctly
  • Choose Tools, Transform tools , and next Move. You can now move the layers that is selected in the layers dialog.

Move the layers until they no longer overlap. If necessary adjust the canvas size.

2

If they are the same size (otherwise, Image>Scale image first)

  • File>Open the first image
  • File>Open as layers the second image
  • Layer>Transparency>Add alpha channel (if it's greyed the alpha channel is already there)
  • Make a rectangle selection around the part you don't want to keep in the top layer
  • Edit>Clear

In effect you create your image by stacking a full first image (green) and a second image (blue) where some of it has been made transparent (grey pattern)

Layer stack

3
  • That didn't work. I just got a white screen with the rectangle and nothing in it.
    – steven
    Jan 26 '19 at 4:47
  • 1
    This should be a comment to the answer, not another answer (or ask a new question). In the meantime try Image>Fit canvas to layers.
    – xenoid
    Jan 26 '19 at 14:46
  • 1
    Fit canvas to layers made my day!
    – Cirelli94
    Jan 25 at 12:26
1

Start with a canvas of desired size, then move/crop/scale both images into that canvas

In most cases, you will have a desired target output image size, and you want to make the two images fit nicely there.

Start GIMP and create an empty canvas (Ctrl + N) with the desired size. Let's suppose that our target is 1280x720 (720p):

enter image description here

This leaves us with an empty white canvas:

enter image description here

Now, let's import the images we want to add to this canvas as layers.

To do that, hit:

Ctrl + Alt + O

and select both images.

The result is that now our list of layers on the bottom right now has three layers:

  • love.png
  • budai.jpg
  • Background

enter image description here

Now, all we have to do is to either:

Just remember that you have to select the layer you want to operate on first from the list of layers: only that layer will be affected!

By doing that, I start with a rough approximation, and then refine it.

For example, that love is way too big for the canvas, so I first scale it down to height 720p:

enter image description here

Now we see that it is going to be too wide to fit, so let's crop a rectangle of half the total width of 640 pixels and move it to the top left corner.

We can crop a rectangle of the exact width by specifying the selection size numerically as mentioned at: https://superuser.com/questions/463585/how-to-set-a-custom-sized-rectangle-select-area-in-gimp

enter image description here

Note that I don't even need to set the exact height, it's just easier to use a very large height so it won't cut the image vertically.

I then move the selection left to the desired position with the mouse, and after cropping we have:

enter image description here

Finally, I start working on the right image.

That one is not tall enough, so we are going to have to upscale it to 720 pixels, which is not ideal, but there's nothing we can do about it.

The cool thing is that I don't even need to cut the second layer, as it is already placed behind the top layer. I can just move it around until it looks good.

This gives the final output:

enter image description here

Test images used:

budai.jpg 1067x600

enter image description here

love.png 1920x1080

enter image description here

Tested on GIMP 2.10.18, Ubuntu 20.10.

If the images don't need to be edited, just use ImageMagick from the command line

If you are using GIMP, you likely need to crop/scale the images to make them into a reasonable composition.

But for the specific case where you don't, ImageMagick from the command line is by far the easiest option as mentioned at https://stackoverflow.com/questions/20737061/merge-images-side-by-sidehorizontally/63575228#63575228 :

convert +append image_1.png image_2.png -resize x500 new_image_conbined.png

and you are done, output:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.