38

I want to join two image files in Ubuntu 12.04. Is there any way I can accomplish this?

Is there any utility for joining image files, perhaps something like MS-Paint in Ubuntu?

2

6 Answers 6

52

As a complement to the other answer on imagemagick and considering the need for a GUI.

Inspired by this post saying that ImageMagick has command line tool named convert to merge images. To join images horizontally (in alphabetical order):

convert +append *.png out.png 

To stack images vertically:

convert -append *.png out.png

That should be run in a terminal into the folder containing png files to join them all.


A GUI for that would be:

a file manager context menu to join selected images.

An easy way when it comes to that is Thunar's custom actions:

To join selected images vertically (into one png file, in alphabetical order, no matter their extension) add this custom action ('Edit - Configure custom actions'):

convert -append %F joined-vertical.png

To join horizontally:

convert +append %F joined-horizontal.png

The same commands can be used in a .desktop file in /.local/share/file-manager/actions which adds a context menu for Nautilus and/or PCManFM.

Example for vertical join:

[Desktop Entry]
Type=Action
Name=Join images (vertically)
Profiles=profile-zero;
TargetLocation=true
Icon=gthumb

[X-Action-Profile profile-zero]
Basenames=image/*;*;
Exec=convert -append %F joined-image.png
Name[en_US]=Default profile
Name[en]=Default profile
Name[C]=Default profile
2
  • OMG! Your convert +append has done the trick. I was very much in trouble to do this simple task. and pinta and gui imagemagic was not working for me. I don't know. But you made it so simple. Thanks. May 26, 2017 at 18:33
  • Simple and straightforward!
    – Yaksha
    Nov 7, 2018 at 8:13
27

"join two images" is a quite vague description, but I'm sure you can do what you want with Gimp. You can install it using Software Center or from the command line using

sudo apt-get install gimp

It is probably closer in functionality of Photoshop than to MSPaint though... which is a good thing.

Here's how to do it in GIMP:

  1. File > New ; create image bigger than both of your images to join combined.
  2. File > Open as Layers ; open your images.
  3. Use the Move [M] tool to arrange your images.
  4. Use the Crop [Shift+C] tool to crop everything when finished rearranging.
  5. File > Export to... to save your output file.

That's it! Instead of GIMP you can use Pinta

0
8

You can use imagemagick to do this. (I am using it as well.)

First install it: sudo apt-get install imagemagick

After that look here for usage, you will find a lot of examples. The best is that you can use it from command line (integrate within a script for example).

1
  • 4
    Imagemagick has also a kind of GUI, type display in Terminal.
    – Frantique
    Dec 6, 2012 at 9:56
2

For anyone that doesn't have the luxury of installing software(ex. on a work computer)...

If it hasn't been removed, libreoffice Draw can also do this if your preference is manual manipulation...(with me guessing what "join" truly means)

You open both instances
cut one image
paste it to the other (or both into new file)
arrange them to preference (postiton/crop/etc)
select the entire new image
right click and convert it to a bitmap or metafile
right-click and save
choose your format

2

Two images side by side:

convert image1.png image2.png +append joined_horizontal.png

Two images one above the other:

convert image1.png image2.png -append joined_vertical.png
1

Use -resize if the images don't have the same width/height

You can fix the height for all of them with the -resize option, e.g. to fix a 500 pixel height on two images joined horizontally:

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

Or for vertical joins, you would want to set a fixed width instead:

convert -append image_1.png image_2.png -resize 500x new_image_conbined.png

Example:

image_1.png 1067x600

enter image description here

image_2.png 1920x1080

enter image description here

new_image_conbined.png 889x500

enter image description here

Related:

How to do it interactively with GIMP

If you need to crop/resize images interactively first, which is often the case, then GIMP is the perfect tool for it, here's a detailed step-by-step: https://graphicdesign.stackexchange.com/questions/83446/gimp-how-to-combine-two-images-side-by-side/145543#145543

enter image description here

SVGs

ImageMagick 6.9.11-60 doesn't handle them, so see:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .