Advertisement


Is there a way to easily resize an image as a Ninepatch would resize in photoshop?


Question

A ninepatch, for those unfamiliar, is described here. In a nutshell, you can take an image and put a few pixels on the outermost pixels to represent which areas should stretch and not stretch when they're used on UI widgets of varying sizes. That's great if the program you're working with knows how to understand a ninepatch style image.

Is there a way to resize something in photoshop in the same way? Normally I would just scale it, but that doesn't work if I want to keep the borders edges a specific thickness and only stretch the center portions.

2011/11/05
1
6
11/5/2011 1:00:00 AM

If you're trying to do this to a raster image, and using version CS4 or later, you can use the Content-Aware Scale tool, in combination with an Alpha channel, to get a similar effect.

First create a new alpha channel in the image, and fill the areas you'd like to protect from scaling with white. Leave the rest of it black.

Make sure the layer you want to resize is selected, and not a background layer. Then go to Edit > Content-Aware Scale.

Once the tool is active, the second option from the right in the options bar should be "Protect". Select the Alpha channel you just created from the drop down list and then start resizing.

2011/11/05
1
11/5/2011 4:29:00 PM