Rotate and Repair Using Content Aware

It is sometimes the case an image needs rotating a little e.g. to level a horizon. The problem in just rotating the image it needs to be cropped smaller that the original size and information from the corners and sides will be lost. This may loose important compositions and image areas.

There is a way in Photoshop CS5 and later where we can use some great tools to rectify the situation, restoring the image without cropping smaller.

Let's Start With The Image

In Photoshop make sure the image layer is not set to "background" (double click the layer if required).

Rotate the Image

Use a guide (drag one from the top ruler) to help align the level. From the Edit menu select Transform / Rotate and rotate the image until the horizon is horizontal.

After rotating you will see the errors in the corners.

Make A New Selection

OK now we need to select the area of the original image. To do this Control + left click (Command left click) the thumbnail image in the layer list. This will give a selection of the original image.

We need the inverted the selection so Shift+Ctrl+I (Menu/Select/Invert).

For the effect to work the selection area needs expanding. The amount will depend on the original image size. Use a value of around 1% of the image height. In my case the image was 533px high and a value of 5 was used.

Now For The Magic

Use the Shift+F5. This presents you with the Fill dialogue. Set the "Use:" selection to Content Aware. When OK is selected your image will now have the corners filled in as if they where always there. Some images may need a little touching up but most of the hard work is done for you.

The final image with the corners filled in by Photoshop

Another Example

In this case we will rotate the image to place the Sea Holly stalk diagonally from the corner of the image.

All of the steps are the same as the previous example.

Initial Image (save this image and try yourself)

Select, Rotate & Move

Inverse Selection

Expand Selection By 1%

In This Case 20px

Use the settings as shown making sure to select "Context-Aware"

The final image with the corners automatically filled to match the surroundings.