News:

"The phone is a remarkably complex, simple device,
and very rarely ever needs repairs, once you fix them." - Dan/Panther

Main Menu

Why do the photos that I attach to a topic display sideways or upside down?

Started by TelePlay, February 22, 2022, 11:15:47 PM

Previous topic - Next topic

TelePlay

Welcome to the world of digital photography where images have a lot more information attached to them than you might think.

The quick answer is the SMF (Forum) security software removes the EXIF image orientation data file from every image and if the image was not taken with the camera or smart phone in its "normal" position, the image will not display properly.

Here's why in detail.

While this issue has been discussed many times in quite a few topics, this topic will efffedtively put into one place why some images attached to Forum posts or replies display, are seen, sideways or upside down.

All smart phones and and digital cameras (hereafter both referred to as camera) have a horizontal or normal position. The camera used to take the images in this topic was an iPhone SE which is about 6 years old. As such, this "sideways issue" applies to digital cameras at least that old and newer.

The iPhone used here has a horizontal or "normal" position when it is held sideways to take a picture. That is when the top of the iPhone (power switch) is to the left and the bottom (speaker/power adapter end) is to the right. For this topic, 4 pictures were taken. The first was in the camera's normal (horizontal) position, the second with the camera rotated 90° clockwise, the third rotated 180° from horizontal (upside down) and the fourth with the camera rotated 270° clockwise (or 90° counter clockwise).

Digital cameras are capable of recognizing the position in which they are being held when the picture is taken. The camera records that position in the "Orientation" field of the image's EXIF (Exchangeable Image File) data file. An EXIF data file is created for and attached to each and every picture taken.

A lot of image information is captured by the camera and stored within the image's EXIF data file. The one bit of data directly responsible for sideways images on the Forum is the "orientation" field. The information stored in that field is used by image display software to show the image as taken regardless of how the camera was held. That information tells the displaying software how to rotate the digital image to correctly display it. An image taken with the camera upside down will display right side up.

The "orientation" information is read by the software being used to open, to display, the image even after the image has been transferred from the original camera to another device (computer, website, digital viewer, etc.) to correctly display the image. The camera that took the image will always display the image correctly on that source camera. Digital display software that "reads" the EXIF Orientation information will rotate the image accordingly and as such, display the image correctly.

The "orientation" information in the EXIF file will be "Normal," Rotate 90° CW, Rotate 180° CW or Rotate 270° CW. This states the position in which the camera was held when the picture was taken.

There is a lot of data, useful facts, about the image that was taken that are saved within the image's EXIF file and for this sideways issue, the most important is camera position (image orientation). When an image is displayed on a different device and/or with different display software, the system being used will look for the image rotation information in the EXIF orientation field and automatically rotate the image so that it displays correctly, as taken. The displaying system reads the image "orientation data" to rotate the image to prevent it from being displayed sideways or upside down.

Four images were taken with the iPhone SE:  1) horizontal or normal; 2) rotated 90° clockwise; 3) rotated 180° or upside down; and 4) rotated 270° clockwise or 90° counter clockwise. The images were transferred to my computer and this quad composite image shows how each was displayed on my computer using both MS Paint and Adobe Photoshop.



All 4 images displayed in their correct orientation regardless of which position the camera was held. None were sideways or upside down.

This is all of the EXIF data for the upper left quad image, the one take with the camera in its normal (horizontal) position.



This image has reds dots and a blue dot. They were placed next to different EXIF files of concern.

The information next to the red dots shows the actual location of where the image was taken using both Lat and Long (top red dot) and GPS (bottom red dot). If the camera's location service is turned off when the image is taken, this information will not be displayed (won't be added by the camera). Some who are traveling may want to know exactly where each of many images were taken. I prefer to turn off  the location service for my camera to keep my location private. I left location services on for these images so I could point out that data field looks like. In these EXIF images, I have xx'd out the the Lat/Long and GPS coordinates for this topic to keep my location private.

The very important EXIF data field is shown with the blue dot. This is the camera "orientation" information and for this first image, it shows the picture was taken with the camera in its normal position. When the image was taken, the camera position was saved in the EXIF file as having been taken in the "Horizontal (normal)" position. You can scroll down to see all of the other image information that was captured by the camera including the direction the camera was pointed when the image was taken (I was pointing the camera about due south for each image), whether or not the flash fired, the RGB color information, maker and type of camera used, the shutter opening and speed, the time the image was taken and the speed at which the camera was moving (taken from a moving car?).

For comparison, this is the EXIF data for the upper right quad image, the one take with the camera rotated 90° clockwise. This image would display sideways if the EXIF orientation data could not be read by the software displaying the image.



Again, you can see red dots (with xx'd out information) and the rotated camera position saved in the EXIF file as the image having been taken with the camera rotated, in this case "Rotate 90° CW."

The reason why images appear sideways or upside down when posted to the forum has to do with Forum site security. Quite a few years ago, members were frequently unable to attaches images. They would get a "security warning" because the software found something that looked like malicious code buried within the coding of the attached image(s).

In a 12 MP digital image, there are about 4,600 lines of code that when "interpreted" by the displaying software reproduces the digital image. These are but 4 or 5 lines of those 4,600 lines of code used to display one (1) image taken with the camera. These lines of code only make sense to software asked to display the image. The code has to do with the color and positon of each pixel within, in this case, a 12 MP image.

======
»'0@SÇãÓñ¯   –ô·Ÿ ÿ –jq¸ú&­{n«ûÿ    êÒ7ÌÑÙÌËž™دŸt
è—¾cæL¹'ž   ¢F´:£³Ò¯þÙáè‹2»>nqò/4ݸðÞ pnU@úð¤Ó¥-¡ÄO9Œ7L
w‡Žýå%çV9öS^uU£=XibÔÃý<²Ž7Eƒè±þµŽ%*Ñ䏸íÇXn@,]AsÓ, §Í\²ÎÓ=£ž¯nÎxèw-pIYi–¡—ÌÓ­¹âKg"¯ºóôù¿_jì</ò_jP7ú¹-àùFA‰Aú~•Ã‰š` G¶e9ôÚ‡ùסxrÍÏ/;å1çÐ?ô#XTvF'¹© ƒVÕ0OËb¹éƒÏãÒ¨M [HbVŠ† N6...¸?~b§ñ ›u}YÀ ›xÁÇH ùU
Q •Óöèê ¤‹nÇIá]CûFöÞI®.3Î×— ûàl7†K™¹c›w
žeàvç¨ô§xr±ñlä,Ґ'Ÿ*vÏ×5›n¶V
‰÷cÈç€Ê1úW]Ίlêõ‹ ß™Û'ì÷~fªÝüÿ \T—°¶ Þ%^V8uÈä89W†Qõ"þ ÔØðbá00.caõ7!çßêjÚf-Wœ3y'êцÉÎA   '\­³~†N"ªõ40&ŸçDòØ·þ<æ¹-FPjK»å¹»¿ Uº)XÀ'ý+¡ñŠi¾ñ4°å$º°±šSýæ /ò©ª!fÓçdùI[–8zÏjÝw"æ¤i¦6›xÒÇh
£?øçêjß8ñ£Ä~á*ªs,6ÂIúœŸçL^/ì—¯Î{œ#ÓtRdñÄDŸâ' íÍ=™©ÔÊÂÕáBʆY™QIûäDçùùV>"aƒãªãwÚï#žÝ[9ÁH£${|•oSoC=¼ù›nN2m‡8ÿ ÌÖW‡gíÜž5
======

The "security warning" resulted from the Forum safety software finding what appeared to be a short string of malware (a virus) within the 4,600 lines of image coding.

That "security warning" issue was resolved by enabling the SMF software's image cleaning option. This option did 2 things. It erases most of the EXIF data (for privacy reasons - and most online image storage and social media sites also do this) and it slightly resizes the image thereby hashing the code (shown above) a bit to remove what may look like malware. This hashing has no noticeable affect on the image itself. The security cleaning algorithm hashes the image code, scans it again to look for malware and if found, hashes it again. It does this over and over, if needed,  until the image is "clean" and at that point the software allows the image(s) to be attached to a post or reply.

By enabling this cleaning option, the "security warning" issue went away but the EXIF data was lost. As such, all images as attached were treated as having been taken in the normal position. The EXIF rotation data was lost so an image not taken in the normal camera position could not be rotated to display it as taken. That meant that any images taken with a camera held in any other than its normal position would be displayed sideways or upside down.

This is the EXIF data, all that is left of it, for the upper left quad image after it was attached to a forum post. You can see most of the information has been removed including the orientation information. In this case, the camera was held in the normal position so the image would display as taken on the forum as taken.



This is the EXIF data, all that is left of it, for the upper right quad image after it was attached to a forum post. Again, you can see most of the information has been removed including the orientation information. In this case, the camera was held 90° clockwise so without the EXIF orientation date, the image would be displayed on the forum sideways.



That is the one and only reason why images display sideways or upside down on the Forum. The camera was not held in its "normal" position when the image was taken and the EXIF orientation data was lost during the upload.

This is how the upper left quad image and the upper right quad image display when attached to a topic on the forum. One correctly displayed, the other sideways because the EXIF information was stripped from the image when it was attached.



The SOLUTION to this PROBLEM: Take all of your pictures holding the camera in its normal position and if that can't be done, use any simple image editing software to display the image and rotate it if necessary. Then save and upload that rotated image as an attachment to a post or reply.

Actually, it's always best to edit images to be attached to the Forum by first using an image editing program to view the image, crop it to get rid of background content and then resizing it to 3,000 pixels on the largest side (12 MP cameras produce an image that is 4032 by 3024 pixels which is quite large so downsizing the image to 3,000 by 2,000 is more than sufficient to present a high resolution image on the forum).

TelePlay

Since I took 4 images of that lamp phone, normal, rotated 90° CW, rotated 180° CW and rotated 270° CW, but only used 2 of them in the topic above, thought it would be interesting to show how all 4 of the images would look if posted to the forum.

First image is a quad composite with notation, the next 4 are the original images as captured by the iPhone SE.

TelePlay

All of the above is interesting but too much for anyone without heavy computer knowledge or lacking the type of image editing software on their computer that will strip off EXIF data before rotating and uploading.

=====

Here is a simple, fast and effective way to correct sideways images.

1) After uploading the image, if it is sideways or upside down, click on the image to make it full sized. Then, right click on the image and click on "Copy Image" in the drop down box that appears.

2) Open Microsoft Paint and while holding the "Ctrl" key down, press "v" to past the image into MS Paint (any other image editing software will work as well).

3) Rotate the image as needed, crop the image as necessary and resize the image so the largest side is 3000 pixels

4) Save that image to your computer desktop

5) Edit your forum post to remove the sideways image and upload (attach) the above processed image.


That's it. You are using the Forum software to strip off the EXIF data in this process.

=====

For example, this image was taken with my iPhone upside down, rotated 180 degrees.



I copied it from the Forum into Paint and rotated it 180 degrees



I cropped out the background, resized it and uploaded that processed photo to the forum.



This uses the Forum image, which no longer has its EXIF data attached, so rotation of that image will not change when uploaded. Will show correctly.


The only other option is to rely on someone else to use their time to do that for you.

TelePlay

The new version (Ver 2.1) of the SMF software may have solved part of this problem.

If you look at this topic that was just posted,

http://www.classicrotaryphones.com/forum/index.php?topic=26100.0

the thumbnail image (shown as an attachment) is sideways but when that image was inserted into the text, the orientation of the image is corrected and the phone shows upright.

Also, if you click on the sideways thumbnail, the image expands to full size in it's corrected orientation upright position.

Don't know all that is involved here, if it works all the time for every image, but the software developers seems to have realized the sideways image issue and took steps to retain any rotation date.

The EXIF data for the thumbnail does not include the orientation/rotation information

I - thumbnail EXIF.png

but both the inserted and expanded image EXIF data shows the rotation (90° CW).

I - Expanded EXIF.jpg


Overall, a lot of the EXIF information is removed from all images, a bit more from a thumbnail, but the rotation information is being retained by the SMF software Ver 2.1) for original attached images.


So, while attached images may be sideways, clicking on the image to expand it will use the rotation EXIF data to display it correctly, or as taken.


You can go to the original topic above to find the sideways thumbnail and click on it to see what happens as it is expanded.