nconvert messes up rotation of iPhone photos

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

Post Reply
mmwin
Posts: 3
Joined: Sun Mar 03, 2019 11:11 pm

nconvert messes up rotation of iPhone photos

Post by mmwin » Sun Mar 03, 2019 11:35 pm

Hi there!

Firstly, I'd like to roughly describe what I wan to do: Every now and then I take bunch of photos (in a variety of different resolutions, some of them taken with the iPhone camera, some others not), which I want to make kind of a slideshow of. Since I'm dumb I go the gritty way and want to do this with ffmpeg (please don't ask me why :D ). In order to do so, they all need to be the same size and to keep the aspect ratio I want to background to be completely black. So far, so good.

I used to do this preparation with XnConvert and everything was fine, the photos were all correctly aligned. Now I wondered why not use nconvert instead to make a neat script that does everything on its own. So I exported my existing configuration

Code: Select all

nconvert -quiet -autocrop 1 255 255 255  -ratio -rtype lanczos -resize 1920 1080  -canvas 1920 1080 center -bgcolor 0 0 0 -out jpeg -q 90 -o ../converted/image_#.jpg ./*
and tested the script with the same (!) photos, so there shouldn't be a lot of surprise. However, there is:

The photos from the other camera were correctly rendered, as far as I have seen. The iPhone photos though, are a mess. A few of them are correctly, some are rotated by 90 degrees and some others by 180 degrees. Now I know, the iPhone camera sometimes has strange rotation metadata, but the same images with the same configuration should in my opinion result in the same output.

I already tried to fix this with adding

Code: Select all

-jpegtrans exif
to the command, but that makes it even stranger. Now the iPhone images are (mostly) correct, but now the other ones are wrong. :shock:

Long story short: Do I miss something here or is there no way to work around that behavior?

User avatar
xnview
Author of XnView
Posts: 31166
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: nconvert messes up rotation of iPhone photos

Post by xnview » Mon Mar 04, 2019 9:01 am

could you send me samples that dont work...
Pierre.

mmwin
Posts: 3
Joined: Sun Mar 03, 2019 11:11 pm

Re: nconvert messes up rotation of iPhone photos

Post by mmwin » Mon Mar 04, 2019 1:16 pm

Sure. Here are a few images that appear upside down if prepared with nconvert, but correctly with XnConvert.

https://www.dropbox.com/s/eebpi8y8axl6o ... v.zip?dl=1

The untouched originals have for some reason the odd metadata "3 (rotated by 180 degrees)" which is wrong, since the are obviously shown correctly in a file viewer. After converting with XnConvert the have "1 (normal)", if converted with nconvert they keep their wrong metadata.

My conclusion would be that XnConvert does some kind of integrity check, which nconvert does not (by default). Can I influence this?

User avatar
xnview
Author of XnView
Posts: 31166
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: nconvert messes up rotation of iPhone photos

Post by xnview » Mon Mar 04, 2019 2:09 pm

what is the problem when converting them? the ouput file is 1920 1080 as requested?
Pierre.

mmwin
Posts: 3
Joined: Sun Mar 03, 2019 11:11 pm

Re: nconvert messes up rotation of iPhone photos

Post by mmwin » Mon Mar 04, 2019 2:41 pm

The resolution is correct, but the images are upside down.

I just want the results of XnConvert and nconvert be the same.

User avatar
xnview
Author of XnView
Posts: 31166
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: nconvert messes up rotation of iPhone photos

Post by xnview » Mon Mar 04, 2019 3:36 pm

mmwin wrote:
Mon Mar 04, 2019 2:41 pm
The resolution is correct, but the images are upside down.
oh ok, without EXIF orientation field?
I'll add an option to remove EXIF orientation.... By default, the EXIF orientation is kept
Pierre.

dlenne
Posts: 5
Joined: Mon Oct 22, 2007 6:39 pm

Re: nconvert messes up rotation of iPhone photos

Post by dlenne » Mon Apr 01, 2019 9:44 pm

I had a comparable problem with xnview and iphone pictures with a rotation command in the EXIF.
It seems, that xnview and the windows 10 photo viewer do rotate the images according to the EXIF - but internet browsers do not, which fires back, when building web pages.
It is a bit tricky to find that out.
I used then an online EXIF strip tool, but an option "apply EXIF rotation (yes/no)" would be nice, along with a command "delete EXIF rotation".

Thanks for the great work in any case!

Post Reply