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?

2 Answers 2


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.

  • Thanks a lot, I was indeed missing the Edit > Paste as New Layer and the Layer > Scale Layer steps, this makes it quite a bit faster, especially using some custom hotkeys.
    – okdewit
    Commented Oct 30, 2015 at 11:44

If you have 6 - 7 repetitive steps, you could jsut script then all, and have then as a single menu action. Documentation is scarse, but if you look for my answers on GIMP here and over StackOverflow, I've approached the subject. Also, there is this nice article here: http://www.ibm.com/developerworks/library/os-autogimp/

Now, without resorting to scripting, you could assign easy to remember shortcuts to the functions you need - go to edit->preferences->interface and enbale the Dynamic Keyboard Shortcuts . From then on, while having a menu item highlighted, just press the desired shortcut for it (no need to go out of you workflow to set up the shortcuts).

SInce what you are doing depend on the gradient and drawing, scripting it would be the way to go. Try getting it done - if you can't code yourself, try asking someone to that for you.

(NB. I recently found out the dynamic menu shortcut feature does not work on the Unit menus of Ubuntu Linux - if you are running Ubuntu, you have to select GIMP Menus through mouse right-clicking in order to be able to pick shortcuts)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.