On high resultion jpg files imread then imwrite change the image orientation [closed]

asked 2016-06-23 11:02:53 -0600

suberri gravatar image

updated 2016-06-23 12:27:31 -0600

My system

OpenCV version: 2.4.13
Host OS: Windows 8.1
python 2.7
Windows photo viewer to view the images.

imreading and then imwrite a picture that was taken from a high resolution camera chances the picture orientation

=============== python code ====================

import numpy as np
import cv2
img = cv2.imread('1-0.jpg')
cv2.imwrite('1-1.jpg',img)

1-0.jpg size = 19.1 MB (20,065,690 bytes)
1-1.jpg size = 9.05 MB (9,492,507 bytes)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-11 15:16:09.966408

Comments

i don't think, this is a matter of resolution.

since some weeks, opencv looks at the exif data in jpeg, and respects the orientation while reading, but that part is not exposed to you at all, so you're unable to (save it somewhere and) "rotate it back to the original orientation" when using imwrite later.

berak gravatar imageberak ( 2016-06-23 12:35:50 -0600 )edit

@sturkmen, you probably know better, than me ;)

berak gravatar imageberak ( 2016-06-23 12:46:05 -0600 )edit
1

i have nothing to say after Alexander Alekhin's answer see also this post

sturkmen gravatar imagesturkmen ( 2016-06-23 13:33:09 -0600 )edit