Page 1 of 1
follow orientation issue
Posted: Fri May 01, 2009 10:48 am
by mastabog
Hi,
I have a series of photos that are all landscape 2592x1944 but some have a 90 degrees orientation flag. I would like to use Nconvert to resize *and* rotate them with the following constraints:
- keep aspect ratio
- *either* width or height be 1024 pixels
- have them rotated following the EXIF orientation flag, meaning that I'd like the end image to be 768x1024 for those that had a 90/270 degrees orientation and 1024x768 for those with 0/180 degrees orientation.
I have tried all sorts of options for nconvert. It always resizes to 1024x768. It does not rotate the photos with a 90 degrees orientation. Among the options I've tried are:
-resize 1024 1024 -ratio -rflag orient
-resize 1024 768 -rflag orient
-resize 1024 0 -ratio -rflag orient
It seems that the rflag orient is ignored ... or maybe I'm missing something, i understand it should switch the W/H and turn the end image into a 768x1024 but it does not.
Any ideas?
p.s. i can do it with imagemagick's convert by using -auto-orient but I wanted to use Nconvert from xnview
Re: follow orientation issue
Posted: Mon May 04, 2009 6:45 am
by xnview
Use
Code: Select all
-ratio -rflag orient -resize 1024 1024
Re: follow orientation issue
Posted: Mon May 04, 2009 11:30 am
by mastabog
xnview wrote:Use
Code: Select all
-ratio -rflag orient -resize 1024 1024
Does the ordering of the command line parameters matter?
If not then I already tried it, see my message above:
mastabog wrote:Among the options I've tried are:
-resize 1024 1024 -ratio -rflag orient
Re: follow orientation issue
Posted: Tue May 05, 2009 7:09 am
by xnview
mastabog wrote:xnview wrote:Use
Code: Select all
-ratio -rflag orient -resize 1024 1024
Does the ordering of the command line parameters matter?
Yes for -resize
Re: follow orientation issue
Posted: Sun Oct 24, 2010 4:51 pm
by szucsati
Hi,
I have a similar problem. My photos are landscape, portrait, or wide. I'd like to resize them in batch.
Let's say these dimensions:
Landscape: 1280 x 960, 1024 x 768, 800 x 600 = resize to = >
320 x 240
Portrait: 960 x 1280 = resize to = >
240 x 320
Wide: 1280 x 720 = resize to = >
320 x 180
If I use batch processing in XnView and select "Keep ratio" & "Follow orientation" it works perfectly. But can't get NConvert to do it, no matter what the parameter order is. Here's my batch file:
Code: Select all
nconvert -out jpeg -opthuff -subsampling 2 -dct 2 -q 98 -rtype lanczos -ratio -rflag orient -resize 1824 1368 -keep_icc -clean 1 -clean 4 -clean 16 -overwrite -quiet *.tif
This makes portrait photos 240 x 180 instead of 320 x 240.
What am I doing wrong?
Attila
Re: follow orientation issue
Posted: Thu Mar 03, 2011 10:03 am
by xnview
Re: follow orientation issue
Posted: Sat Apr 21, 2012 2:58 pm
by u0206397
Hi this might have come a little late but I found something while facing and researching the same problem i.e. the output images were not auto-oriented or rotated while the input images though not oriented correctly as image files have the correct EXIF data embedded inside. The workaround that works for me requires 2 steps: step 1 rotates the source image, followed by step 2 which does the resizing based on the existing orientation (landscape/portrait).
Step 1:
Code: Select all
nconvert -jpegtrans exif -out jpeg -o output.jpg input.jpg
The
-jpegtrans exif seems to be applied silently or implicitly when the batch processing is done via the XnView or XnConvert GUI, but not so in NConvert command line.
While running, for those input images that need to be oriented or rotated, NConvert will report:
Code: Select all
Lossless transformation of input.jpg : OK
This may alarm the user as if the original input image is being rotated and modified but I have checked and the input image remains unchanged, while the intermediate output file is rotated correctly. Seems to me the transformation took place in memory and get written out correctly, while leaving the original input image file intact. Just my observation so far but I might be wrong,
so try this out yourself using a copy and don't blame me if you get your input files overwritten!
Step 2:
Code: Select all
nconvert -ratio -rflag orient -resize 640 480 -overwrite output.jpg
Note: The output.jpg from step 1 is an intermediate working copy that is eventually overwritten by the resized version of itself.
Hope this helps or provide some clue to others with the same problem. Btw, I experimented with combining both the JPEG transformation and resizing in one command by specifying all the switches but failed. NConvert seems to happily transform but ignore the resizing, so I had to keep them separated into 2 commands for now.