Filling in empty files with blank images when using Montage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
stromhurst
Posts: 3
Joined: 2018-03-08T05:09:05-07:00
Authentication code: 1152

Filling in empty files with blank images when using Montage

Post by stromhurst » 2018-03-08T05:13:52-07:00

Hi all, this is regarding the montage utility.

Currently, you can give it a tile grid, like 5x8 and then give it images of the same resolution and it stitches them together. For a 5x8 grid, it will need images numbered from 0.png(or whatver) all the way to 39.png . In my particular application, most of the times, some of the sequence images will be missing. so for example, there is a 4.png and 6.png but no 5.png, how do I tell montage to fill in a blank image at that position?

For right now, I am just finding the names that are missing from the sequence and manually adding a blank file and naming it to the missing ones.

Thank!

User avatar
fmw42
Posts: 23244
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Filling in empty files with blank images when using Montage

Post by fmw42 » 2018-03-08T10:31:05-07:00

Make a list of your files in the order you want. Where you want an empty space put null: (with the :).

image1 image2 image3 null: image4 etc

stromhurst
Posts: 3
Joined: 2018-03-08T05:09:05-07:00
Authentication code: 1152

Re: Filling in empty files with blank images when using Montage

Post by stromhurst » 2018-03-08T12:16:45-07:00

Hi fmw42,

Actually i never knew about that you can order your files regardless of their name in the command line... But sadly, its not efficient, as the the amount of files is about 40-50 typically.

snibgo
Posts: 10280
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Filling in empty files with blank images when using Montage

Post by snibgo » 2018-03-08T13:03:49-07:00

stromhurst wrote:there is a 4.png and 6.png but no 5.png, how do I tell montage to fill in a blank image at that position?
Montage won't do that automatically. You need to tell montage to use blanks in those positions, which means you need to give it a list of images instead of a wildcard. You can build that list in a script.
snibgo's IM pages: im.snibgo.com

stromhurst
Posts: 3
Joined: 2018-03-08T05:09:05-07:00
Authentication code: 1152

Re: Filling in empty files with blank images when using Montage

Post by stromhurst » 2018-03-08T14:10:18-07:00

ok, Any other utility to do something similar?

If not, then anyway to make the background colour black, as currently, if i do null: that block is white and I want it black.

User avatar
fmw42
Posts: 23244
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Filling in empty files with blank images when using Montage

Post by fmw42 » 2018-03-08T14:37:29-07:00

Add -background black to your montage command. See https://www.imagemagick.org/Usage/montage/#settings

Post Reply