Thursday, March 15th, 2012

Content aware resizing in Gimp

In a previous post, I looked at content aware resizing in Photoshop CS4 http://projectwoman.com/2009/09/smart-scaling-with-content-aware-scale.html which is the same as in CS5. I also mentioned the online application called Rsizr http://www.rsizr.com. Today I’m going to show you a plug-in for Gimp that does pretty much the same thing.

The tool is called Liquid Rescale which you can download from here: http://liquidrescale.wikidot.com/. Close Gimp, install the application and then reopen Gimp and you will see the application on the Layer menu.

This plug-in is an alternative to the crop tool. You use it to reduce an image’s size but, where the crop tool removes the data from one or more sides of an image, content aware resizing removes it from the middle of the image. This gives you basically the same looking image but smaller in one dimension. You might use this, for example, to remove some empty area from the middle of an image where the more interesting parts of the image are to either side of it.

The same tool can scale an image up to make it larger in one direction – and this time it will create extra data in the image to fill the space. You might use this, for example, where you have a rectangular image that you want to make into a square image without losing any detail.

To see how this can be done, I’ll take this beach image and size it down from 3571 pixels wide to 3000.

Open the image in Gimp and choose Layer > Liquid rescale. When the dialog appears, click the Output tab and set Output Target to a New Image. Enable the Resize image canvas checkbox and click Ok.

Set the new image width – I set this to 3000 but made sure that the link icon was disabled as I don’t want the height altered. Click Interactive and wait as the image is resized.

The program resizes the image by removing unimportant details from it and keeping what it understands to be the important bits. This is the result:

If you find that some elements in the image are squeezed or damaged by the process, you can create a mask to prevent this from happening.

To do this, click the original image again and choose Layer > Liquid rescale and set up the Output tab options.

Click Feature Masks and, to create a protective mask, click the Feature Preservation Mask option and click New. The paint color will be set to green so select a brush, enlarge it to an appropriate size and paint over anything on the image that you do not want to change as the image is resized.

In my case, that is the swimmer at the front of the image and the lifeguard and boards at the back. I’ve added some other bits I don’t want skewed out of alignment like the vertical poles too. Anything else can be adjusted except these elements. When you’re done, click Ok.

Type the size for the new image and click Interactive and wait as the image is resized. Here I chose for the image to be reduced from 3571 to 2500 pixels wide, and the surfer, boards and flags have all reduced well. The protected areas have not been touched.

The plug-in also has a tool that you can use to remove elements from the photo. In my image let’s take out the large pole in the foreground. In this case you use a Feature Discard Mask – and paint in red over the area that you want removed from the image. Adjust the strength to the highest value, set the width value by clicking Auto size: Width so that the image is scaled to the appropriate width for the item you are removing and click Interactive.

In this case, the flag has gone but we’ve got a bit of a repair job to do with the rest of the image to fix it up. It would require some work with the clone tool to fix up the image but Liquid rescale has got us some part of the way towards where we are headed.

You can also use the plug-in to enlarge an image. In this case, we’ve enlarged the image to create a square image.

The rescaling process isn’t perfect but generally you’ll get a good enough result that with a small amount of cloning afterwards using the clone tool you’ll be able to produce a realistic result.

Helen Bradley

Tuesday, September 8th, 2009

Smart scaling with Content-Aware Scale


New to Photoshop CS4 is its Content-Aware Scale tool which allows you to transform an image in a way that you’ve never been able to do before in Photoshop. The technology itself has been around for some time and you may have been familiar with the website rsizr.com which offers content aware scaling as an online service. However, the feature is now built into Photoshop making it a readily accessible tool for images large and small.

In this post, I’ll explain how to use content aware scaling and how to protect areas of your image from being distorted in the process.

Step 1
To see the tool at work open an image in Photoshop CS4 (this feature is not in other versions of Photoshop), double-click the background layer to turn it into a regular layer and choose Edit > Content-Aware Scale.

Step 2
Notice the sizing handles on the image. Drag from one side inwards and watch what happens as you do so. You’ll find that the image shrinks in size, but most of the information in the image is still there – the image is made narrower but key elements in it are not squashed up.

If your image includes people, click the person indicator on the toolbar so that it is not pressed in – when the indicator is flush with the toolbar the option is selected. This protects people by recognizing skin tones and ensuring that they are not distorted by the effect.

Step 3
You can also protect elements in the image using an alpha channel mask. This technique is handy if you have areas of the image that you want to retain at the expense of other areas and it can also be used to protect people in the image.

Make a rough selection around the area that you do not want to be affected by the scale effect. A good tool to use is the Lasso tool – select an area and hold the Shift key to make a second selection over another area, if necessary.

Choose Select > Save Selection, type a name for the selection, such as detail mask, make sure that the Channel is set to New and the operation is set to New Channel and click Ok. Press Ctrl + D (Command + D on the Mac) to deselect your selection.

Step 4
Now choose Edit > Content-Aware Scale and from the Protect dropdown list on the toolbar, select the mask you just created. Scale the image and notice that the masked areas are protected from being damaged as the image shrinks in size.

Content-Aware Scaling is a handy way to change the aspect ratio of an image. For example, you can turn a landscape image into a square image and close up the space between people in a photo if they are a long way apart. It also works in reverse and you can use it to make an image larger. You may need to do some work with the clone tool to repair small areas of the image damaged as the result of the scaling but typically the tool does a very good job.

If you don’t have Photoshop CS4 then head, image in hand, over to rsizr.com and give the online tool a try. Here is an earlier post I wrote on the Rsizr tool.

Helen Bradley

Thursday, June 4th, 2009

Rsizr – Image scaling on steroids

While Photoshop, Lightroom and Photoshop Elements can resize images for you, only Photoshop CS4 supports content aware scaling. I’ll talk about this new feature in Photoshop in another post but if you’re interested in playing with content aware scaling and you don’t own Photoshop CS4, check out Rsizr.com

Rsizr resizes images by removing the unnecessary content from them or by stretching neutral areas of the image to make the picture bigger. It’s worth a visit just to see it at work.


Start by uploading an image that you want to resize. This should be a JPEG, .PNG or GIF file with a height and width of less than 2,880 pixels – in practice, so you can see what’s going on quickly, upload an image sized smaller than this.

Once the image appears in the dialog you will see tabs with buttons for various functions including the File Function tab, View functions, Resize and Retarget functions.


The program uses a seam carving technique to remove portions of the image. To get started drag the horizontal slider in the top of the window in to the size you want the image to be resized to. Click the Retarget button and watch as the seams are created (they’re the red marks you can see in the image) and the file shrinks in size.


Once the seams have been created, you will see a set of sizing handles around the image which you can use to resize the image either to make it wider or narrower.


You can protect areas of the image or mark them for deletion by clicking the Preserve or Remove indicators on the retarget functions tab and paint over the area to keep or remove.


You might do this, for example, if you see some distortion in the resizing process and want to protect key portions of the image.

The rescale and crop tools are similar to what you’re used to using in your photo editing software – it’s the retarget option which is unique.

If you’re interested in learning more about seam carving technology, visit: www.seamcarving.com to see a video describing it.

Stop Press! There is a cool plug-in available for the Gimp which brings content aware scaling/seam carving to the Gimp. For more information and to get the download, check here: http://liquidrescale.wikidot.com/ and note that the Gimp version is called Liquid Rescale! Just in case you thought there weren’t enough ways to refer to the same thing.

Helen Bradley