Problem with "<" in command line (montage -geometry)

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
derboo
Posts: 2
Joined: 2014-05-22T19:03:47-07:00
Authentication code: 6789

Problem with "<" in command line (montage -geometry)

Post by derboo »

I'm trying to merge together a bunch of images with montage, but I'm having problems with the command. I want to use -geometry '1x1+0+0<' to have the images without resizing and without gaps, but the command line in Windows 7 seems to have a problem with the "<" character.

This is my command line as I type it in:
montage.exe filename*.png -tile 2x1 -geometry '1x1+0+0<' filename.png

But the command processing turns it into this:

montage.exe filename*.png -tile 2x1 -geometry '1x1+0+0 0<'

And I get an error message that the file cannot be found. Is there any way to get around this issue?
Last edited by derboo on 2014-05-22T21:12:19-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with "<" in command line (montage -geometry)

Post by fmw42 »

In Windows, I believe you must use double quotes rather than single quotes.

What was the exact error message -- what file was it complaining about?

But try just -geometery +0+0. That should force no spaces and leave the images alone, except to pad to the same height.

This aligns them centered:

Code: Select all

montage logo: rose: -geometry +0+0 -tile x1 -background black result.png
This aligns them at the top:

Code: Select all

montage logo: rose: -gravity north -geometry +0+0 -tile x1 -background black result.png

Using < in the geometry pads the smaller rose: to the same size as the logo:. I do not think that is what you want.

You can also just use

convert images -gravity XX +append result

to put several images side by side.

Code: Select all

convert logo: rose: -gravity north +append show:
This does the same as my second command using montage command. This is simpler than dealing with all the montage features.

see
http://www.imagemagick.org/Usage/montage/
http://www.imagemagick.org/Usage/layers/#append

Set the background to "none" or "transparent" if you do not want to see the background fill.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with "<" in command line (montage -geometry)

Post by snibgo »

As Fred says, use double-quotes in Windows.

Without them, the shell interprets "<" as file redirection, taking the contents of the file (on the right) as stdin for the command (on the left). So it looks for a file called ...

Code: Select all

' filename.png
... or possibly just ...

Code: Select all

'
... which doesn't exist.
snibgo's IM pages: im.snibgo.com
derboo
Posts: 2
Joined: 2014-05-22T19:03:47-07:00
Authentication code: 6789

Re: Problem with "<" in command line (montage -geometry)

Post by derboo »

Alright, that did the job, thanks.
Post Reply