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.
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:
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.
file1.jpegin the native Gimp format. Say we save it to
- 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
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
- Now choose File, Open as Layers and open
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.
1One last step I added at the end was Image → Fit Canvas to Layers– DebajitDec 21, 2022 at 2:22
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
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)
That didn't work. I just got a white screen with the rectangle and nothing in it.– stevenJan 26, 2019 at 4:47
1This should be a comment to the answer, not another answer (or ask a new question). In the meantime try
Image>Fit canvas to layers.– xenoidJan 26, 2019 at 14:46
Fit canvas to layersmade my day! Jan 25, 2021 at 12:26
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):
This leaves us with an empty white canvas:
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:
Now, all we have to do is to either:
- Move (M)
- Scale. You will want to use Right Click -> Layer -> Scale layer instead of Shift + S, because Shift + S makes the edges of the image transparent: How to prevent edges of a layer without transparency from becoming semi-transparent when scaling up with Shift+S in GIMP?
- And to use Scale layer, you might want to get the height of the smaller layer to match the other one to it. This can also be obtained by going into the Scale Layer menu of the other image, but not making any changes
- Crop as shown at: GIMP: How to crop a layer?
- Rectangle select (R)
- Layer > Crop to Selection
- You might want to crop to a exact dimension based on the other layer, this can be done numerically from the selection menu as shown at: https://superuser.com/questions/463585/how-to-set-a-custom-sized-rectangle-select-area-in-gimp
- And after you enter the desired selection size, you might want to move the selection around to the area of interest: GIMP: How to move a selection in a layer?
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:
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
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:
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:
Test images used:
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:
1+1 for reminding me about ImageMagick. Saved me easily 30 minutes and hundreds of clicks. Lovely! Mar 1 at 23:39