Try something like this:
montage file1.jpg file2.jpg -geometry +0+0 -background none output.jpg
This will make the border between images as small as possible and whatever is there will be transparent.
To see a demo of the difference using builtin images, try these and compare:
$ montage rose: -resize 100x60 rose: -geometry +0+0 -background none montage.jpg
$ display montage.jpg &
$ montage rose: -resize 100x60 rose: montage.jpg
$ display montage.jpg &
See Montage Usage.
If you post an example of what you're getting and manually edit together an example of what you'd like as a result, we might be able to get a little closer to that.
Here are examples that I like better than the ones I originally posted above:
montage \( rose: -resize 100x46\! \) rose: -background gray montage.jpg
montage \( rose: -resize 100x46\! \) rose: -geometry +0+0 -background none montage.jpg
Install the Perl package Image::ExifTool
. It includes a command-line program called exiftool
that can change EXIF, IPTC, XMP, and many other forms of image metadata:
$ exiftool -IPTC:caption="This is a great image" image.jpg
ExifTool understands a great many other tags as well.
There's a good chance that your OS has an ExifTool package already. It's in the Ubuntu package repository as libimage-exiftool-perl
, in FreeBSD Ports as graphics/p5-Image-ExifTool
, and in OS X Homebrew as exiftool
, for example. The official site distributes Mac OS X and Windows standalone versions.
If you have cpanm
on your system, the second easiest way to install exiftool
is:
$ sudo cpanm Image::ExifTool
You can also install through cpan
, which is only slightly more involved, once you get past all the questions it asks the first time you run it:
# cpan
cpan> install Image::ExifTool
cpan> exit
If you have neither cpanm
nor cpan
installed, even installing from source is not hard:
# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/E/EX/EXIFTOOL/Image-ExifTool-9.53.tar.gz
# tar xvf Image-ExifTool-9.53.tar.gz
# cd Image-ExifTool-9.53
# perl Makefile.PL
# make install
Run the program without arguments to get a detailed manual page.
Best Answer
Try adding
-auto-orient
to the command you're running,$ convert -auto-orient img1.jpg img2.jpg +append both.jpg
Your images have EXIF data telling your viewer which way to present them, but without
-auto-orient
, ImageMagick ignores that.Think of it another way, how does anything know which way your camera was pointing when you took the image? Horizontal or vertical, it's all the same size and same number of pixels. The EXIF data tells viewers whether your camera was in a landscape or portrait orientation, and which way up it was, so it knows which way to show the image.
So you don't want to stop ImageMagick from rotating them, it's not rotating them, it's just not using the EXIF data to work out which way up your camera was and assuming everything is landscape or portrait. So you need to tell it to actually rotate the one that was shot in the non-default orientation. Hopefully,
-auto-orient
will achieve that.