1

If I select a specific area, I want to increase that selection by one pixel in all directions. I know that I can do that through the Grow function. But I also want to fill in the pixels that have been added with the pixel border of the previous selection.

How can I achieve this?

Edit:

Image for explaining what I want to achieve:

enter image description here

Reason: (for anyone who is wondering, why?)

I have a sprite sheet with a size of 28x15 tiles each made of 32x32 pixels. I use this sprite sheet in Unity3d and split it into 32x32 pixel sprites.

The problem with this is that sometimes scaling the sprites does not work 100% correctly. Unity then automatically uses adjacent pixel columns or lines to fill in the blanks. Since these rows/columns are part of a new sprite, it sometimes causes strange lines between the sprites.

So I want to create a buffer around each sprite. The tiles then have a size of 34x34, but only the inner 32x32 are used in the sprites and the border around it is a buffer to avoid these lines

4
  • Sorry, I didn't read Gimp. I leave this answer in Photoshop, maybe Gimp has the Maximum filter too. I found this in internet: –Filters:Distorts:Value Propagate. Use "More white" for Maximum–
    – user120647
    Jul 26, 2018 at 18:54
  • Thanks for the quick reply, but unfortunately the filter adds no pixel border but only changes the previous image and indeed every pixel :( But I would like that the image is maintained and in addition another border is drawn around the image in the corresponding colors
    – Kaskorian
    Jul 26, 2018 at 19:20
  • @Danielilo in GIMP it's called the Dilate filter. It's found under Filters > Generic > Dilate. The opposite function is called Erode, and located in the same place.
    – Billy Kerr
    Jul 26, 2018 at 21:57
  • @Kaskorian - I think GIMP might be the wrong kind of software for this. It's much easier to add strokes and outsets in vector software such as Inkscape (which is also free). Can you show what you are trying to edit/trying to do? It might help pin down a better solution.
    – Billy Kerr
    Jul 26, 2018 at 22:05

3 Answers 3

1

Set up the canvas as follows: Open the 32 x 32 image. Click Image > Canvas Size. Set it to 34 x 34, and hit Center. Click Layer > Layer to Image Size.

Using the Rectangle Select tool, select one row of Pixels, Copy CTRL+C and Paste CTRL+V. Use the arrow key to move the pasted row into position. Hit CTRL+H to anchor the floating selection. Repeat for each edge.

enter image description here

0
  • Make a new Layer Mask with the Selection
  • Click the Mask Icon
  • Menu Filter > Other > Maximum = 1 pixel

MAXIMUM

0

Several processes come to mind:

Resynthesizer

A simple one could be to use the resynthesizer plugin and the Heal transparency.

Merging with larger tiles

  • produce an image where each tile is its own layer. A possible way iis to use the ofn-tiles script to chop your image and export, then reload the images using File>Open as layers... (there may be a script that does that directly).
  • duplicate the image
  • On the first copy, do Image>Scale image and set to 34*34. Let's call that one the "scaled" copy
  • On the second copy, do Image>Canvas size and set to 34*34, and center the current image ([Center]) button. Let's call that one the "resized" copy
  • Use the interleave-layers script to to merge each layer of the resized image over the matching layer of the scaled image. Invoke the script from the scaled image to merge the resized image over it. Essentially, the output border of the 34*34 image is a scaled version of the border of the 32x32 image.
  • Export all layers using ofn-export-layers
  • Reload the layers as one image using ofn-tiles

The scripts are here

The ofn-* scripts have their own doc in the ZIP. interleave-layers is described here. Use of a suitable naming scheme in ofn-export-layers and ofn-tiles will keep the layers in the proper order/position.

Your Answer

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

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