Why Images in some Camera Apps are Upside Down on the Nexus 5X
New users of the Google Nexus 5X may have noticed a peculiar problem arise when they snap a picture using some third-party camera apps – the image ends up being upside-down!
This issue isn’t exclusive to the Nexus 5X, though, as it has previously occurred on the front-facing camera of the Nexus 6. What causes this problem? Is it a manufacturer issue, or a software issue? Turns out it’s a bit of both.
According to Eino-Ville Talvala, the tech lead for Android’s camera framework, the issue arises because some manufacturers mount their camera sensor for their devices in an uncommon orientation. In order to comply with the Android compatibility requirements, manufacturers must align the long-edge of their camera sensor with the long-edge of the device (meaning by default the back camera sensor should be oriented such that the images are landscape). However, there is no requirement for which particular landscape direction the sensor must face. Typically, most manufacturers use a forward-landscape oriented sensor, but LG/Google chose to orient theirs reverse-landscape. Space comes at a premium on most mobile phones, so manufacturers often have to make do with the constraints they’re given. The Nexus 5X is no exception – a quick look at a teardown reveals that little room is left in the device for the mainboard thanks to the whopping size of the battery.
Because this reverse-landscape orientation is rarely seen, many third-party application developers do not correct for this orientation when processing an image. Using the old Camera API, developers can fix this camera orientation issue by calling on the setDisplayOrientation() method to check the sensor for the correct UI orientation and properly rotate the image. With the introduction of the Camera2 API, however, this is no longer necessary as the API ensures the preview is correctly oriented. Still, if you notice one of your favorite apps incorrectly orienting your pictures, kindly shoot them an e-mail asking them to update their code to correct for this oddity.
Have you come across this issue yet? Let us know in the comments below (and especially let the developers know!)