Whenever I take photos there is always the grueling task of orienting them correctly so that the horizon looks straight. Modern cameras do have an orientation sensor that tells you if it's a portrait or a landscape shot, but nothing more precise. Why not include a cheap orientation sensor (like the ones we have in every phone) so that the photos could later be all automatically aligned if needed? Or perhaps such cameras already exist?

  • 7
    Many recent cameras incorporate gyroscopic sensors. Some write roll and pitch information to EXIF header. Exiftool will probably show whether that is the case for a particular camera. It should be possible to build a pixel pipeline exiftool -> imagemagick to preprocess images to a more desirable orientation when such data is written an accurate and automatic rotation meets the photographic intent.
    – user50888
    Sep 27, 2017 at 14:25
  • 4
    As a practical solution, I've used a hot shoe bubble level.
    – user50888
    Sep 27, 2017 at 14:27
  • 16
    "Modern cameras do have an orientation sensor that tells you if it's a portrait or a landscape shot, but nothing more precise." Your premise is incorrect - see this question for example from 3 days ago: Nikon D7200, turn on virtual horizon in viewfinder
    – osullic
    Sep 27, 2017 at 14:42
  • 9
    Is the horizon always perfectly perpendicular to the "up" vector?
    – A C
    Sep 27, 2017 at 19:30
  • 6
    @AC: When it's not, we call that a hillside or a mountainside.
    – dotancohen
    Sep 28, 2017 at 8:06

8 Answers 8


My Pentax K5ii can use its sensor shift capability to rotate the sensor to level the horizon, I also get a 2 axis level readout in the viewfinder or on the rear display. Some cameras do have the capability you describe.

  • 1
    Looking at the EXIF data of a Pentax was how I determined some cameras write pitch and roll data to EXIF. On the other hand, I find the weather sealing more useful.
    – user50888
    Sep 27, 2017 at 15:43
  • I agree, I've actually never used the auto leveller, although I do refer to the level readouts fairly often. The sealing is far more important to me. Sep 27, 2017 at 16:56
  • Just bought a Pentax K5 and RTFM to find it can indeed do this.
    – John U
    Sep 28, 2017 at 15:19
  • @JohnU I think the K5 was the first Pentax with this ability. I believe it can also do astro tracer if you get the hotshoe mounted GPS module. Can't remember off the top of my head if we get composition adjust on the K5 or if that was a K3 thing. Sep 28, 2017 at 15:22
  • 1
    You can add a bit more info in your answer: if you set it to output in jpeg and activate the Auto Horizon Correction option, the old entry level K50 can use it's horizon level sensor to rotate the picture (not the sensor, obviously) before saving it.
    – motoDrizzt
    Sep 30, 2017 at 10:47

My Nikon D800 had a digital artificial horizon, so yes some cameras do have this.

However, rotating images in software is absolutely a last resort as it can lead to odd moire effects and you will lose some of the periphery of the image.

Of course rotating images when using film photography at the print stage doesn't suffer from optical issues.

As is the general rule with all photography, get it right in-camera and only tweak in post if you must.

  • 2
    Rotating a digital image introduces moiré and cropping?!
    – osullic
    Sep 27, 2017 at 17:06
  • 11
    @osullic yes-- the digital chip has sensors arranged in a square grid. Film is a more or less uniformly random distribution of light-sensitive molecules-- there is no periodicity. Check out this section of the wikipedia page about moire patterns to see what can result when you rotate a grid: en.wikipedia.org/wiki/Moir%C3%A9_pattern#Rotated_patterns
    – user151841
    Sep 27, 2017 at 17:35
  • 2
    @osullic, how can you rotate e.g. 5° without cutting the edges afterwards, i.e. cropping?
    – Gerhardh
    Sep 27, 2017 at 20:04
  • 4
    The get it right in camera and tweak in post only as a last resort should be writ in stone... Sep 28, 2017 at 5:57
  • 3
    ^^^ it should be a message on startup like on stat navs :-D Sep 28, 2017 at 6:47

My Canon DSLR has an electronic leveller that I can enable on the LCD screen when composing an image. I'm not sure if that data gets written to the exif data of the file or not. I'm not sure if this is a mid/high end feature but it's not a new feature; it's in my 6D which was released in 2012.

Software applications like Photoshop and Lightroom and probably many others have levelling tools, including automatic modes, where they can detect lines in the image that should be horizontal or vertical.


there is always the grueling task of orienting them correctly so that the horizon looks straight

Setting the camera level doesn't necessarily make the "horizon" look straight. It works when the background is an ocean or a vast plain, but it's not uncommon to have a mountain or hill or the far shore of a lake in the background. Those may not technically be a horizons, they can still make your photo look crooked.

Beyond that, it's really not a "grueling task" to orient your photo to match the strong vertical or horizontal lines. The viewfinders in most DSLRs generally have an array of autofocus points that are visible even when not selected, and you can use several colinear AF points as a guide.

Get into the habit of asking yourself: Does the distance between the leftmost AF point and the horizon look the same as the distance between the rightmost AF point and the horizon? Or: Would a line drawn through the center column of AF points be parallel to the vertical axis of my subject's face? If you remember to look at camera orientation when you're shooting, it's pretty simple to avoid problems.

Why not include a cheap orientation sensor...so that the photos could later be all automatically aligned if needed? Or perhaps such cameras already exist?

Many do. Canon started to include electronic levels at least as far back 2011: the 6D, 60D, and T3i each have one. As far as I know, the electronic level is purely a composition aid, however; the information isn't included in the EXIF information for each image, so you couldn't use that information to automatically adjust each image afterward.

  • 1
    I wonder why it's not included in the EXIF though... would be great for simple shots. Sep 27, 2017 at 17:46
  • 1
    Some manufacturers probably include it, but in the form of proprietary tags that software like exiftool can only process once somebody figures them out. Sep 28, 2017 at 1:51
  • And forget about Adobe products ever reading such proprietary info contained in the maker notes section of the EXIF info!
    – Michael C
    Sep 28, 2017 at 7:56

Let me start out by saying I'm an engineer not a photographer, the kinds of cameras I work with cost in the tens of millions to hundreds of millions of dollars, but I think for the purposes of this questions I might be able to help.

Often "a sensor" is cheap, but "a sensor that is accurate enough, and provides the right information" is incredibly expensive.

Most cameras probably provide a 3 Degree Of Freedom accelerometer. This means that you could get 3 acceleration vectors relative to the accelerometer (Note I did not say "what direction is down"). To determine what direction is "down" you have to do a 3 dimensional transform (not hard) and assume that the camera is not moving (also probably reasonably easy). Then you have to determine how accurate it is (was the accelerometer misaligned from the focal plane when the image was snapped? how much of that was due to factory calibration, and how much was due to post factory slippage?). Then you need to present it to the user (do you give them all three dimensions? If you give them only two dimensions how do you encode the third dimension in that?).

So in the end you have, more software (software engineers are expensive), more documentation (documentation is expensive), possibly more calibration (calibration is expensive) for a feature few people will understand or use.

  • 1
    For the purposes of a DSLR, the sensor is probably cheap. Currently, even relatively inexpensive point and shoot cameras sometimes include image stabilization based on moving the sensor in response to camera shake and modestly priced Pentax DSLR's will rotate the sensor a degree or two in order to create a horizontal horizon in the image.
    – user50888
    Sep 27, 2017 at 21:54
  • @benrudgers when you say "will rotate the sensor a degree or two" I assume you mean the image sensor? If so I don't believe they have actuators on the image sensor.
    – Sam
    Sep 29, 2017 at 14:25
  • 1
    Pentax DSLR's perform shake reduction (image stablization) by moving the sensor. Many will rotate the sensor automatically to adjust "the horizon". Some more recent Pentax cameras will move the sensor under the Bayer filter to sequentially collect RGB data at each pixel location on the sensor...the sensors can also be set to vibrate on power up in order to reduce dust accumulation. Cameras are amazingly high tech precision instruments, their ubiquity just makes it less obvious.
    – user50888
    Sep 29, 2017 at 18:11

Correcting an arbitrary rotation in post processing always means significant resolution loss and/or computational effort - unlike correcting 90° where you just swap the axes (and maybe even do so before compressing the image for storage - algorithms like JPEG are not totally agnostic of lines vs columns).

It is likely that a manufacturer would not only have to use an expensive sensor (mind that $5 or $10 in bill of material cost for a quality MEMS gyroscope will never just translate into $5 or $10 more on the sale price), but put enough computing power, with high power efficiency, onboard the camera if they want to sell it as a well-integrated feature. If the recomputation yields bad quality, takes several seconds or drains the battery, the camera will likely be perceived as worse quality than if the feature was not added.

Of course, it would be an option for expensive devices that had such computing power anyway to implement digital correction for interchangeable lenses.

  • Note that some cameras actually rotate the sensor by up to several degrees to compensate.
    – mattdm
    Sep 29, 2017 at 20:25
  • highly interesting. which do/what is the technology name? Sep 30, 2017 at 20:13
  • Pentax is the only one I know for sure; I think they just call it "Horizon Correction". They use their sensor-shift image stabilization in several other interesting ways too (shift for perspective correction, or to track the earth's rotation for long-exposure star photography without trails).
    – mattdm
    Oct 1, 2017 at 0:47
  • "Sadly, experiments for the next generation of horizon correction caused severe earthquakes and terrain damage" :) Oct 1, 2017 at 11:18

Every digital camera I've used has had the option to superimpose crosshair lines on the display. Typically these are at the thirds, but others may also give you crosshairs at the centre. It simply is not "gruelling" to get the horizon in line with the crosshairs.

So why don't we have this? Simply because anyone capable of holding a camera steady enough to take a non-blurred photo, and of reading their camera's manual to find how to turn on the crosshairs, does not need that feature.


The last few Panasonic DMC-TZxx cameras that I have had, (technically point & shoot but very handy to have because they can be carried everywhere), have had the capability to turn on an artificial horizon on the viewfinder which makes levelling the camera, (if desired), very quick and simple.

They even change colour from Yellow to Green when you have a level.

  • Can you also use this information to turn the photo automatically in Lightroom later? Sep 30, 2017 at 6:36
  • @NikitaSokolsky Personally I use GIMP, ImageMagick, ExifTool, etc., so I could easily do so but it is so much easier to level the camera using the artificial horizon, (unless I deliberately wish a skewed shot). Sep 30, 2017 at 8:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.