4

I took two photos with my phone, one horizontal and one vertical, and they show up fine in Eye of Gnome. When I try to glue them top-to-bottom with ImageMagick's convert:

$ convert img1.jpg img2.jpg +append both.jpg

The horizontal one rotates to be vertical before being appended. The same thing happens if I make them side-by-side with the -append option.

How can I use convert to append one image to another without rotating them to be the same dimensions?

7

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.

  • 1
    It works, although it should be said it must be put at the beginning of the command: convert -auto-orient img1.jpg img2.jpg +append both.jpg. – user1717828 Mar 4 '16 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.