Jump to content

Create a photo collage from the Linux command line


aum

Recommended Posts

design_photo_art_polaroids.png?itok=SqPL

 

Here's how I use ImageMagick to make photo grids for my social media posts.

 

ImageMagick is the "Swiss Army knife" of manipulating images on the command line. While you could use a desktop graphics program like GIMP or GLIMPSE to adjust or combine photos and graphics, sometimes it's just easier to use one of the almost dozen tools from ImageMagick.


For example, I frequently find myself creating image montages to share on social media. Let's say I wanted to share a montage or "image grid" of several screenshots. To do that, I use the ImageMagick montage command. 

 

ImageMagick is a full suite of tools, and the one I use here is the montage command. The general syntax of the montage command looks like this:

 

montage {input} {actions} {output}


In my case, my screenshots are already the same size: 320x240 pixels.  To create a montage of six of these images, in a grid that's two screenshots wide by three tall, I can use this command:

 

$ montage acronia.png \
ascii-table.png \
music.png \
programming-chess.png \
petra.png \
amb.png \
-tile 2x3 -geometry +1+1 \ 
screenshot-montage.png


This creates an image that's composed of the six screenshots, with a 1-pixel border around each. Doing the math, that's 644 pixels wide and 726 pixels high.

 

Note the order of the images: ImageMagick montage arranges the images from left-to-right and top-to-bottom.

 

screenshot-montage_0.png

(Jim Hall, CC BY-SA 4.0)

 

In my example, the first row of images shows the open source 2D shooter Acronia and an ASCII programming example, the middle row is an open source music player and a chess programming example, and the third row shows the open source game Post Apocalyptic Petra and the FreeDOS AMB Help reader.

 

Install ImageMagick on Linux


On Linux, you can install ImageMagick using your package manager. For instance, on Fedora or similar:

 

$ sudo dnf install imagemagick


On Debian and similar:

 

$ sudo apt install imagemagick


On macOS, use MacPorts or Homebrew.

 

On Windows, use Chocolatey.

 

Source

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...