Page 1 of 2

rotating pictures

Posted: 21 Jul 2014 19:21
by pwe
I am using FH 5.0.9 with Win 8.1
I have added a portrait picture to an individual. I added it by using the add media button on the multimedia tab of the individual's property box. The picture was taken with the camera in portrait mode but the camera has automatically adjusted the picture so it can be viewed properly in the camera without rotating the camera. I have downloaded the image to my computer and it is still showing in the correct orientation for viewing - portrait.
But when I add it to FH the image is in landscape mode. Is there any way to correct this please.
I have tried rotating the image to landscape mode and then adding it to FH but it makes no difference, the picture remains in landscape mode.
Peter E

Re: rotating pictures

Posted: 21 Jul 2014 19:28
by pwe
Further to the above I meant to add that the offending pictures are showing as landscape mode in the multimedia window showing all media.

pwe

Re: rotating pictures

Posted: 21 Jul 2014 19:31
by tatewise
How are you rotating the image in Windows?

If correctly rotated and saved then it should stay that way.
I don't believe FH does anything to rotate images.

When you use FH to add Media and insert from file, how does the file browser display the image?
Is it in Portrait or Landscape orientation?

Re: rotating pictures

Posted: 22 Jul 2014 10:16
by jimlad68
This might sound messy, and from other comments you might not need to do it, but might save you time in the long run.

The orientation of your picture (say in an *.jpg) is determined in the EXIF info. The default seems to be Orientation = Top Left. If you view the picture or thumbnail and it is in the wrong orientation you can usually request the viewing program to "rotate" it. The program can do various things. It can set the orientation in the EXIF info to make the picture view correctly without losing quality. OR it can keep the Orientation = Top Left but recreate the detail in the file to do that, but with a jpg which is not a lossless format, detail may be lost. OR the program can correct it's own thumbnail to view correctly and remember the correct way to view (I think Windows does that). This can be very confusing when viewing in different programs.

The least confusing way I have found is to convert my photos to always have Orientation = Top Left. But how to do it with a lossy format like *.jpg without losing quality. I use the free Irfanview (probably other programs do this too) which has a JPG Lossless Rotation feature and you can set Orientation = "whatever"

http://www.irfanview.com/
or for a standalone version http://www.liberkey.com/en/catalog-flat-list-view.html

Open your picture > I for information > EXIF info > shows Orientation (only if it has been set).
then back and drop down menu Options > JPG Lossless Rotation and play around with the options. I keep Optimize jpg file (is lossless and may make it smaller) and Apply Original EXIF..., write JFIF, Keep all APP

Then check the picture again with I for information > EXIF info > shows Orientation and look for Orientation = Top Left.

Any programs that have created thumbnails (e.g. Windows) may now show it incorrectly so you will have to reset your thumbnails FOR THOSE PROGRAMS. (On windows I think there is an option on disk clean up to just remove thumbnails and it starts again). You should be able to find it online somewhere for each program.

I'm away at present with limited internet, so can't give a fuller answer. Someone else may have a better technical answer.

Re: rotating pictures

Posted: 22 Jul 2014 11:01
by tatewise
I have been using Google Search to investigate this problem, and the Win 8.1 Auto-Rotation could be confusing things.

BUT setting the EXIF as Jim suggests should work.

One thing to check is that the file is NOT set Read-only otherwise any rotation edits may NOT be saved.
In File Explorer, right-click the image file and choose Properties, then at the bottom of the General tab, check the Attributes: have Read-only unticked.

Re: rotating pictures

Posted: 22 Jul 2014 18:30
by pwe
Jim & Mike,
Thanks very much for your helpful replies.
Mike - The images are nor read only.
Jim -I followed your directions (completely new territory for me) using Irfanview, and the images were orientated bottom left as you suspected. I have changed the relevant images to top left orientation and then re-entered them into FH and all is well. Thankyou.

I am sure this must be to do with Win 8.1 as I have earlier entered images (Win XP) where no such problem has occurred.

Peter E

Re: rotating pictures

Posted: 23 Jul 2014 09:08
by davidm_uk
Googling "exif orientation" shows just what a mess things are with respect to orientation! Lots of programs, including browers and operating systems either don't interpret the EXIF tags, or interpret in different ways at different times.

I've got a copy of all my family photos on a media player attached to the TV. When I moved from XP to WIN7 and did an update on the photos quite few then displayed sideways!

Can + Worms comes to mind.

Re: rotating pictures

Posted: 24 Jul 2014 08:56
by tatewise
This does appear to be a minefield.

I have just reviewed a handful of my image files (a mixture of JPG, PNG, TIFF, etc).
The vast majority are downloads, and have no EXIF data at all, or do not include the EXIF Orientation field.
It only appears to be my JPG Photos that have the EXIF Orientation field.

Until now I have used either the Windows Explorer image right-click Rotate clockwise/counterclockwise option, or the IrfanView command Image > Rotate Left/Right.
I was unaware of the IrfanView command Options > JPG Lossless Rotation.

I have now found warnings online about various such rotate options degrading image quality and upsetting EXIF data.

I am currently using Windows 7, but Windows 8 appears to be a new ballgame.

How do others (especially the photo & image experts) deal with this scenario?

Does this warrant a KB article on the subject?

Re: rotating pictures

Posted: 24 Jul 2014 10:41
by davidm_uk
Mike, I'm sure that a "noddies guide" explaining the problem and possible solutions would be very useful, I've only recently become aware of it, other than being irritated at finding some of my photos seeming to have rotated themselves after I'd put them into my library folders in the correct orientation.

Finding a solution(s) might not be straightforward, as "programs" that display photos seem to behave in various ways, and programs that do rotation also behave differently.

I'd be happy to help - investigating, testing, reviewing, whatever, but I'm by no means an expert at image manipulation!

Re: rotating pictures

Posted: 24 Jul 2014 11:01
by Jane
There is a tool called JHead which can remove the rotation tag or auto rotate digital camera images to match the recorded rotation.

http://www.sentex.net/~mwandel/jhead/

As it's a small standalone exe, it would probably be possible to build it into a plugin to rotate images already in FH.

I don't tend to have any problems, but my images normally get exported from Lightroom if they are shot on my Cameras so are second generation anyway. (I don't shoot in jpg on most of my gear, so the images have to be converted to jpg anyway)

edit: Another thought, it would probably also be possible to write a rotate plugin in just Lua using the GD library.

Re: rotating pictures

Posted: 24 Jul 2014 11:40
by tatewise
Sorry Jane, but for me Jhead poses as many questions as it answers.

It only handles JPG format, so what about all the other image formats (PNG, TIFF, etc)?

The Jhead documentation says:
-autorot The program 'jpegtran' is used to perform the rotation.
JPEGTRAN
For windows, it's hard to find a pre-built binary on the web. The Independent JPEG Group's website only has the source code. There's a fancier version, with pre-built Windows binaries and a lossless cropping feature added at: http://sylvana.net/jpegcrop.
So where would a Plugin get JPEGTRAN?

The Jhead documentation says:
-norot Clears the Exif header rotation tag without altering the image.
So after that does the Windows/File Explorer right-click Rotate clockwise/counterclockwise or any other built in Photo app image rotation work satisfactorily (albeit with a small loss of quality)?

Otherwise, presumably we still need to consider the IrfanView command Options > JPG Lossless Rotation?

I don't see the point of a Rotate Plugin as there are so many other ways to rotate images already?

Re: rotating pictures

Posted: 24 Jul 2014 12:56
by Jane
Fine, I only offered it as a suggestion. EXIF Rotation issues normally only happen with Cameras with orientation detection, and I don't know of any which store png and these days I can't think of any modern cameras which do TIFF either.

Removing the rotation flag using -norot would mean it's obvious in other applications that the image needs rotating. For lossy rotations as I said you could use IM which is built into FH Lua anyway, which would handle all the formats. For a single rotation even with loss it would not be great as long as a high quality setting was used. Where problems are normally worst are where people are editing images and loading and saving them many times at say 60 (or 6) quality.

Re: rotating pictures

Posted: 24 Jul 2014 14:05
by tatewise
The more I investigate this the more confused I am getting!

This article http://www.impulseadventure.com/photo/e ... ation.html talks about Rotation and Orientation but is dated 2008!
It states which applications do & don't recognise EXIF Orientation, but says it is not the default in IrfanView, but in my recent version it is the default, so the info is out of date.

I tried using Jhead -norot on a JPG file and nothing happened.
The EXIF Orientation remained unaltered according to IrfanView.

I tried using Jhead -de on same JPG file and it said it Modified: file. (although no file Modified or Accessed dates changed)
But sure enough in IrfanView the EXIF data was all gone.

Re: rotating pictures

Posted: 24 Jul 2014 20:16
by jimlad68
Still on limited internet, so not able to research much, but from memory many programs (possibly Windows) when asked to rotate actually do a lossy rotation, hence loss in quality, whether it is enough to worry about I do not know. That is why the first thing I do with a photo is get the Orientation Top Left (which as far as I can understand is the default if it is not stated in the EXIF data).

- If it is a jpg file, I would do it with IrfanView command Options > JPG Lossless Rotation.
- If it is PNG = lossless format (my currently favoured format, but that is another whole subject) I would ensure it loaded to a picture editing program (photoshop/or the free GIMP etc) correctly and if not rotate, then save correctly.
- If it is TIFF = lossless format, load to picture editing program, ensure correct orientation and save as PNG (or TIFF if you prefer).
- A scan - If it will fit in the scanner in the correct orientation, easy, just scan. If you need to do it sideways, the scanning software might rotate for you, BUT might alter the Orientation from top left. SO you may need to check as above. Easiest when scanning is to scan direct to your picture editing program which gives you full control.

I think it is important to do this BEFORE using your picture/image in ANY program, not just FH. So unless a LUA/FH fix would correct the ORIGINAL picture (as above), it may still leave future confusion.

Re: rotating pictures

Posted: 25 Jul 2014 10:15
by tatewise
After a bit more experimentation with Jhead I have discovered what its -norot option actually does.
The Jhead documentation is a little misleading in saying:
-norot Clears the Exif header rotation tag without altering the image.
What it actually does is reset the Orientation tag to 1 which is the usual default Top Left setting.
If already set to 1 then Jhead does nothing.
All image editors will then assume the image is in the correct orientation regardless of whether they recognise the EXIF setting.
Any actual image rotation will then be retained OK.

However, an image editor such as IrfanView also resets the Orientation tag to 1, and performs JPG Lossless Rotation for the main image and corrects the thumbnail image.

IrfanView is FREE, is widely respected & used, and performs many other useful functions.
I suggest the KB article explains how to use it to fix image rotation for all image formats (JPG, PNG, TIFF, etc).
If any members have similar advice for other image editors, then that can be added later.
How say you ? ?

Re: rotating pictures

Posted: 01 Aug 2014 17:16
by tatewise
I have added some how_to:v4:adding_multimedia&#photo_orientation|> Photo Orientation advice involving IrfanView.

Re: rotating pictures

Posted: 01 Aug 2015 13:45
by AdrianBruce
Nearly created another thread on this topic until my mental "tatewise" simulator routine prompted me to search!

I've only just hit this issue and it's with images of pages of a Crew List Agreement. These images would normally be associated only with my source-records and I tend not to print those in FH reports, so the impact is not large. But there might be other cases...

Basic question - what would be the issues (apart from time and money) in amending FH to use the EXIF Orientation value?

Re: rotating pictures

Posted: 01 Aug 2015 15:20
by davidm_uk
Slightly OT for the FHUG but may be related somehow.

All my photos are backed up onto my OneDrive. Despite appearing in the "correct" orientation on my PC I have some images that are displayed incorrectly on OneDrive, so I decided to experiment with Irfanview as suggested on the KB link above.

I've carried out the procedure and the photo still displays correctly on my PC, but is now upside down (it was just sideways) on OneDrive. Looking at the Exif info on the PC shows;

Filename - 53 Eyam Hall, May 2015.JPG
Make - Panasonic
Model - DMC-TZ35
Orientation - Top left
XResolution - 180
YResolution - 180
.................(unrelated stuff deleted)
Thumbnail: -
Compression - 6 (JPG)
Orientation - Right top
XResolution - 180
YResolution - 180
ResolutionUnit - Inch
JpegIFOffset - 12788
JpegIFByteCount - 5911
YCbCrPositioning - Co-Sited

Any clues as to what's going on?

Re: rotating pictures

Posted: 01 Aug 2015 15:41
by tatewise
Adrian, yes that would be an interesting feature.

David, did you follow the instructions when the associated thumbnail image is incorrectly orientated to set Transformation to None, tick Rebuild EXIF thumbnail, and click Start?
I think that should correct the thumbnail Orientation.

Re: rotating pictures

Posted: 01 Aug 2015 17:31
by davidm_uk
Mike,

Yes I did follow the instructions all the way through, including setting Transformation to None, tick Rebuild EXIF thumbnail, and click Start. The picture opens correctly in all of the graphics viewer and editing programs I have on the PC, but the Exif is as per the above post.

Re: rotating pictures

Posted: 01 Aug 2015 18:18
by tatewise
It matters whether what you are seeing is the full image or just a thumbnail.

However, it seems odd that it is now upside down, because Orientation - Right top should be sideways.

Are you sure the OneDrive copy has synchronised correctly?

When displayed in OneDrive, exactly where are you looking?
In your OneDrive folder on the PC, or online via your browser?

I suspect OneDrive is displaying the thumbnail, so when you open that OneDrive file in an image viewer is it oriented correctly?

You may have to repeat the instructions to reset the thumbnail EXIF Orientation, and also maybe Save the image afterwards.
(Perhaps try it on copy to avoid degrading the JPG image unnecessarily.)

[P.S. EDIT:
Earlier postings suggest that EXIF data is sometimes changed without changing Created/Modified Dates, so I suspect if those dates do not change then OneDrive may not resynchronise the file?]

Re: rotating pictures

Posted: 01 Aug 2015 19:13
by jimlad68
David, just a thought, have you tried deleting completely from wherever it is wrong, give it a different name with the correct rotation etc, then upload again. Things like onedrive are too clever (or lazy) by half and may keep old thumbnails and even old versions of a picture.

Re: rotating pictures

Posted: 02 Aug 2015 15:27
by AdrianBruce
I have raised a wishlist item Use of Rotation meta data in images (12795) to cover my proposal that FH should respect and use the EXIF Orientation metadata.

One limitation I mention there is that the EXIF Orientation metadata values can be useless when the camera is pointing directly down. I found this recently in Kew when my (portrait) pages were coming out all over the shop in terms of their orientation in my image browser. I was quite happy when I found how to rotate the images in my Canon supplied software using the metadata - then immediately deflated when I found FH ignored all the corrections I'd made. That's why I started this quest.

Re: rotating pictures

Posted: 12 Aug 2015 21:30
by mjashby
Just found a small freeware Windows utlility which may be useful: "JPEG Lossless Rotator" at http://annystudio.com/software/jpeglosslessrotator/

Some Features:

Shell integration — rotate your JPEG photos with a right-click on a file or folder!
Automatic rotation.
Batch rotation.
EXIF-data display.
Flipping, deletion and renaming of files.

The FAQ Section provides an explanation of why/how EXIF data can get 'messed up' when taking photos of documents on flat surfaces and how to correct that problem using the software.

Using a utility like this could possibly avoid the potential for loss of image quality when using inbuilt image rotation features, but I'll have to leave it to any imaging experts out there to consider how serious/trivial such problems really are.

Mervyn

Re: rotating pictures

Posted: 14 Aug 2015 14:54
by davidm_uk
I've been playing with the "JPEG Lossless Rotator" mentioned above and have had excellent results provided it's used before any rotation or other editing has been done with other programs. It will correct individual photos, a whole folder, or a whole folder including any sub folders, and seems quite fast. Certainly the image quality, in terms of number of pixels, is preserved.

Probably best to try it first on a copy of your pictures.

When you first install it you have to choose if you want the original "date taken" preserved or changed to the date you ran the program, it doesn't have an options setting to change this after you've installed the program. If you do want to change the mode of operation after installation, just run the installation process again.

Obviously limited in that it only handles JPG files, and I've only tries it in Windows 7.

On a slightly related note, I've also been playing with pictures on my Android tablet, and found that QuickPic https://play.google.com/store/apps/deta ... r&hl=en_GB is easy to use, allows quick rotation (which it then remembers) and allows files to be displayed in filename sequence, handy for me as I always rename my photo files with a leading "serial number" plus place and date, as I might want the displayed sequence to tell a story that's not in "date taken" order. Worth a look (it's free).