CAS Secrets :: Photoshop CS4 and Photoshop CS5
Steve Weinrebe
www.ImagingRandR.comIn almost every Photoshop training I do, when I reach the discussion about cropping I get asked a common question, “Can I crop to a different ratio and keep all the picture information?” Up till now I would always sigh and give the tough answer, in a word, “no”, at least not without distorting the image. Enter Content Aware Scaling, one of the most compelling additions to the new Photoshop CS4. Content Aware Scaling, or CAS for short, is a feature that allows transforming the aspect ratio of an image without distorting the important content of the image. CAS works best with some images and not so well with others, however I have been consistently amazed at what CAS can do.
The photograph above, of my daughter at the beach, is a good example of the type of image that lends itself extremely well to CAS. In scaling this image I have done nothing other than to apply Content-Aware Scale from the Edit menu, with Steps 1 through 3 below, and with no area of the image protected from the scaling, not even using the “Protect Skin Tones” feature.
I will show the basics here, but more importantly there is a slightly advanced technique that I would also like to share so that photographers can use CAS to their best advantage right out of the box.
This is an example of an image that may work with CAS, but which might pose problems as well. Most examples demonstrating CAS show a figure, or two figures, against a mono-tonal, textured, or patterned background that doesn’t look awkward when scaled taller or shorter, wider or narrower. As long as the central figures maintain their proportions the scaling is usually visually successful.
There are two fundamental ways to scale an image in order to ensure the integrity of part of the image:
* click the “Protect Skin Tones” button in the Options bar after choosing “Content Aware Scaling” from the Edit menu if skin tones are a large enough part of the picture for the CAS algorithm to recognize and protect (note again that I didn’t even bother, in the beach scene above, to use the Protect Skin Tones feature and CAS still worked quite well), or
* create an Alpha Channel with white representing the protected area that CAS will tend to ignore, and black representing the area of the image that CAS will scale. Here are the steps for protecting an area using an Alpha Channel.There is an added control, the Amount field which allows the user to control how much Content Aware Scaling is applied during the transform. Entering and amount of 0% would be like scaling an image using Transform. An amount of 50% would apply Content-Aware Scale with only half the effect. Read on to see my own technique for the intensity of CAS locally to an image.
Let’s follow through the steps to use Content-Aware Scale, as well as protect specific areas of an image using a mask.
1. Duplicate the layer that you want to apply CAS to, in this case the Background layer. To duplicate the layer, drag the Background layer to the “New Layer” icon (the little dog-eared document at the bottom of the Layers Panel), or press Command (Mac), or Control (Windows) – J, to duplicate the layer. (Note: because the Background layer is locked, CAS as with other Transform functions cannot be applied to it.)
2. To be able to see the affect of CAS on the duplicate layer it is a good idea to turn the visibility of the Background layer off.
3. With the duplicate layer selected as the active layer in the Layers panel, choose Edit > Content-Aware Scale, or press Command-Option-Shift-C (Mac), or Control-Alt-Shift-C (Windows).
In all the examples that follow I am scaling the image on center to 75% width, which can be done by holding the Option (Mac), or Alt (Windows), key while dragging a side handle inward; or by entering 75 into the Width field in the Options bar.
4. Here is the effect of CAS with no protected area. Unlike the photograph of the child on the beach where much of the image is uniform, there is so much information here that we need to create a protected area using an Alpha Channel. Here I’ll tap the Escape key, top left of the keyboard, to exit the CAS bounding box.
5. We could begin the process of creating the alpha channel mask for CAS by using Quick Mask mode, but honestly this is a great use of the very basic Freehand Lasso tool. Here I simply drew a freehand selection around the figure, leaving some room all around the central figure.
6. Now all we need to do is feather the selection by clicking Refine Edge in the Options bar (available whenever a selection tool is the active tool) and adjusting the Feather slider. I used a fairly sizable feather of 40 pixels for this high-res image.
7. Once the selection is feathered I can save the selection by clicking the “Save selection as channel” button at the bottom of the Channels panel.
8. Here is what the alpha channel, created from the saved selection, looks like. The white area represents what will be protected from the scaling effect, once I choose the alpha channel as the source for protection.
9. Now I’ll go to Edit > Content-Aware Scale once again and in the Options bar, from the Protect drop-down menu, choose Alpha 1 (the saved alpha channel).
10. Voila, the image has been scaled, but the area protected by the white in the alpha channel, Alpha 1, is untouched by the scaling. This is amazing technology, and if you have been following the introduction of CS4 you may know this much already. But there is more.
We could reduce the overall effect of CAS using the Amount field in the Options bar, but that is a global control. Let’s say I want to maintain the aspect ration of the central figure in the photograph, the pepper vendor, and to a lesser extent maintain the proportions of some of the peppers to the left of the figure.
11. In the Channels panel, turn on the visibility of Alpha 1 by clicking the “eye” icon to the left of the channel, which makes the alpha channel visible in the image in Quick Mask view (red representing the black, or masked, area and white representing the white, or un-masked, area). Then click on Alpha 1 itself to make Alpha 1 the active channel.
12. In the Brush tool options I’ll make the Opacity 60%. Now by painting with white in the image using the Brush tool (which paints “clear”, or takes away red from the Quick Mask view), I can paint white onto Alpha 1, extending the area to be protected. However by painting at 60% opacity, a light gray tone is painted onto the alpha channel, not 100% white.
13. By applying Content-Aware Scale from the Edit menu once again, and choosing the altered Alpha 1 from the Protect menu, we can see that indeed the image is scaled with the central figure (white in the alpha channel) entirely protected, and the peppers just to the left of the figure partially protected by the 60% tone in that area of the mask.
I have found this technique - varying the opacity in the mask - to be invaluable as a way to locally control CAS on less than typical images. Be aware though that often protecting one area of an image will cause CAS to scale another area of the image more than is desirable. There is always going to be some give and take and it helps to know your goals and limitations so that the image can be properly scaled and the best results can be achieved.
Steve Weinrebe
steveweinrebe.com
modestudio.us
Steve Weinrebe:
Mode Studio
Photography © Steve Weinrebe, Getty Images