Although Instagram for iPhone has included the option to straighten images for some time, an engineering post published yesterday details how the Instagram team made it possible. Clicking on the icon in the app's post-processing menu uses data from your phone's accelerometer and gyroscope to automatically work out the optimum angle for a straight photo. After your image is aligned you then have the option to tweak the exact angle using a sliding scale. The team originally planned on offering users a full set of sliders to offer precise control, but decided that would go against the app's focus on simplicity.
The option to align your photos is available now through the iOS app, but there's no word yet on an update for Android users. Since coming to Google's OS late, Instagram has been quick to add new features to the Android version of its app, so it's unlikely to be too long a wait. If you want to learn more about the new addition, you can read a detailed explanation of how Instagram's engineers decided upon and implemented their ideas over at the Instagram Engineering blog.