Quickly resizing canvas using "border pixels" to fill up new space in Gimp


I noticed that one of the tasks I often perform in Gimp comes down to making a different aspect ratio version of a simple PNG (an icon with a simple gradient background for example). They can be resized in a visually appealing way by enlarging the canvas, and simply sampling the pixels on the border of the image to fill up the new space.

My usual workflow:

  • Set bigger canvas size without scaling image (for example, twice the canvas width, with original little image in the center)
  • Set layer to image size (So I can edit the empty space)
  • Select a small "stripe" of the background gradient, copy, paste, drag and press the key so it snaps to horizontal movement.
  • Copy/paste bigger and bigger stripes, until I reach the edge of the canvas.

This can be a bit labour intensive. Is there a quicker way to do this, or maybe a way to automate the "stretch this 1px-wide selection to the edge of the canvas" part?

10/29/2015 11:04:00 PM

Accepted Answer

Assuming the gradient is vertical only (ie. uniform width-wise):

  • Select the vertical stripe to be copied
  • Copy and paste to a new layer
  • Scale that layer to full width of image
  • Move layer below original layer

Alternatively, once you've copied the stripe to GIMP's clipboard, you could just create a new layer and then drag the stripe from the Patterns dialog (clipboard is the first entry) to fill the layer.

If the gradient is not quite uniform width-wise, you will probably need to do the two halves separately, but the same idea.

10/30/2015 5:01:00 AM