Open the image in Photoshop to be corrected and choose the Ruler tool (‘I’ or right-click on the Eyedropper to bring up the Ruler Tool). Drag a line along a horizontal or vertical straight edge. Click the Straighten button in the options bar to automatically rotate and crop the photo. To avoid automatic cropping, hold down the Option key when you click Straighten.
Learn how to straighten an image using Photoshop CS5's ruler