How to put two pictures next to each other?
Show older comments
I have a landscape and a portrait image, and I want to put them next to each other to form a single picture, so I want to resize the landscape height to be equal to the portrait width. jpg pictures
Answers (1)
Walter Roberson
on 15 Dec 2015
0 votes
6 Comments
Walter Roberson
on 15 Dec 2015
See also montage()
Mr M.
on 15 Dec 2015
Edited: Walter Roberson
on 15 Dec 2015
Walter Roberson
on 15 Dec 2015
imread() does not rotate images. Use
imfinfo('fig1.jpg')
imfinfo('fig2.jpg')
and you will likely see that they are the same dimensions in the file.
There might be padding in different places in the images.
Walter Roberson
on 15 Dec 2015
It sounds as if the EXIF Orientation header is set in the image; see http://www.impulseadventure.com/photo/exif-orientation.html
Walter Roberson
on 15 Dec 2015
You can read the EXIF information using http://www.mathworks.com/help/matlab/ref/exifread.html to determine which direction you need to rotate the images. After that, you can imresize() and then you can use image() with XData or use montage() to put the images side by side.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!