Advertisement
  1. Photo & Video
  2. Photo Manipulation

How to Stretch and Squeeze Photos With Guided Content-Aware Scaling

Scroll to top
Read Time: 4 min

What happens when you need to fit an image to a space with a different shape than the original? Maybe you're trying to fit a rectangular image to a square box on the internet, for example. Your choices come down to either cropping or scaling the image.

It doesn't matter if you're a photographer, graphic designer, or web designer: if you work with images, scaling is an essential part of your workflow. Web designers might scale an image to make it web-friendly, finding the trade-off between quality and page load times. For photographers, scaling images is often about delivering the correct file size to a client for their usage. Graphic designers are always massaging images to match their designs, scaling and cropping images to fit the publication.

Bad scaling examplesBad scaling examplesBad scaling examples
What if we needed to fit an original image to a square box? On the left, you can see the original image. On the right side, there are two examples of making the image fit to the square shape. The second frame shows bad scaling that leaves the original image distorted. The third image is a basic crop, with important pixels omitted from the image. We need a better solution.

Frustratingly, both of our choices have flaws: cropping leaves important pixels out of the image, and scaling distorts the image. Luckily, Photoshop has a "best of both worlds" approach with the content-aware scale tool.

In Photoshop CS4, Adobe introduced content-aware scaling. This tool feels a little like magic, and helps us scale images intelligently. No longer do you have to choose between cropping an image or distorting with scaling when you have to place an image.

A New Alternative: Guided Content-Aware Scaling

Content-aware scaling guesses which pixels can be removed from an image. It looks for common areas with potential pixels to "give up" when scaling.

Content-aware-scalingContent-aware-scalingContent-aware-scaling
This image illustrates the magic of content-aware scaling. The example I gave above was that we needed to fit the building image to a square shape. Notice that content-aware scaling has done a nice job of trimming the less important pixels, such as the tree on the left and some parts of the middle of the building.

Here's the thing: content-aware scaling isn't perfect. Photoshop is guessing which pixels can be scaled, and the logic isn't always correct. The results can distort important parts of the image that shouldn't have been adjusted. The finished image can be distorted and important features are disturbed.

Shortfalls of Content-Aware ScalingShortfalls of Content-Aware ScalingShortfalls of Content-Aware Scaling
I used content-aware scaling to turn this rectangular image into a slightly more square shape. However, notice the doors on the left and right edges of the building. Content-aware scaling guessed the wrong pixels to scale, and distorted the doors in the process.

You can use a technique that I call guided content-aware scaling to improve the accuracy of the tool. Basically, this technique will show Photoshop which pixels you are okay with giving up and scaling.

Guided Scaling

First, make a selection around the pixels you want to protect. Then open the Channels tab, and click the circle-in-square icon to Save selection to channel. This makes a layer called Alpha 1. Deselect (Command-D), and go to Edit > Content-Aware Scale (Command-Shift-Alt-C). Select Alpha 1 from the Protect dropdown. Now pull and stretch to make the content-aware scale.

Recap & Keep Learning

The guided content-aware scaling technique takes a powerful tool and gives it some rules for which pixels should be protected.

  • You'll often be using content-aware scaling to fit an image into a different shape than it originally occupied. This is because of aspect ratios, and this tutorial by Andrew Gibson will help you understand the concept.
  • If you've never used the content-aware tools before, this tutorial from 2009 is a great introduction.
  • Users of content-aware scaling are often trying to fit an image in a space for the web. This tutorial on How to Export JPGs for the Web has some suggestions for resizing for web-friendly images.

How are you using content-aware scaling? Have you tried guiding Photoshop while using the tool? Let me know about your experiences with this tool in the comments.


Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Photo & Video tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.