How To Stitch Images Together With ImageMagick

in blog •  7 years ago  (edited)

In this mini-tutorial you will learn to stitch images together.

We will do the stitching with a tool called ImageMagick. It is a great tool, but it is not the most intuitive program on the planet.

Installing ImageMagick

macOS

If you use macOS the installation of ImageMagick is quite easy. Just use the Homebrew package manager. If you do not have it installed, you can get it on the Homebrew website.

After having installed Homebrew, you should have the brew command available when you open the Terminal application. Try to issue the following command in Terminal:

brew --version



If you get the version number, you are ready to install ImageMagick using brew.

brew install imagemagick



If the installation of ImageMagick was successful you should be able to use the following command:

convert --version

Linux And Windows

You can find installation instructions for other operating systems on the download page.

Now Let's Stitch

We want to stitch two images side by side.

Open the Terminal application on your computer and change the working dir to the folder where you saved your images.
I have downloaded two images from Pixabay:

Here is the first picture I downloaded:

City JPEG

And the second image is this one:

Stars JPEG

Now we want to stitch the two images together so that the images stand side by side. We can achieve this with the following command:

convert city.jpg stars.jpg +append cityStars.png



Notice that the command will take two images in JPEG format, but will save it as a PNG image. You can make the output any format you like by using the proper file extension. If you want to create the output file in JPEG format, just use .jpg.

If you use -append, instead of +append you can stitch images together so that the output shows the photos stacked.

Here is the result:

cityStars PNG

Conclusion

Stitching images together with ImageMagick is easy. The most prominent hurdle you have to jump over is the installation process and using the tool on the command line. But if you are not using your command line you are only using 10% of your computer's brain :)

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

hey so nice I really like your post! Lets make steemit together to a better place with our content! I would like to read a bit more about you? Look my Introduceyourself like I do it. I went to jail because of cryptos : https://steemit.com/bitcoin/@mykarma/3-jail-review-from-colombia-to-madrid-and-then-straight-to-jailng-time

Thanks for your kind words. Yes, I certainly try to make Steemit a better place.

I already came across your post a few days ago. You are the guy from Switzerland, right?

You got a 5.59% upvote from @nado.bot courtesy of @cutemachine!

Send at least 0.1 SBD to participate in bid and get upvote of 0%-100% with full voting power.

1.33% @pushup from @cutemachine

You got a 3.33% upvote from @allaz courtesy of @cutemachine!