0

I have a sprite that is a single PNG image with each cell being 64x64 pixels. Is there a way in GIMP 2 to to somehow shave off the border of each cell so that it will become a PNG image that holds 60x60 pixel cells?

Is there also a way to include a 1px black border in each of the 60x60 cell as well?

  • Shaving the border off an image is called "cropping". There's a crop tool in GIMP. – Billy Kerr Apr 23 at 18:41
  • Yeah, but the sprite image is a single PNG file. Within that file holds many individual square images (cells). How would you split these cells within that file into individual 64x64 images, then 'crop' them to 60x60, then save them again into a single PNG file? – doejoe Apr 23 at 18:42
  • There's probably no way to automate that in GIMP if that's what you are asking. It would be a tedious manual edit: selecting a 60 x 60 portion of each image, and copying and pasting them and repositioning in a new document. – Billy Kerr Apr 23 at 22:22
  • @BillyKerr: can GIMP remove entire columns and rows from images? (It'd still be manual work but much less than all that copy-and-pasting.) – usr2564301 Apr 24 at 20:47
  • With a script maybe. xenoid seems to have given you a solution perhaps. – Billy Kerr Apr 24 at 21:32
2

With the ofn-layer-tiles script:

  • Starting with:

enter image description here

  • Layer>Tiles>Split tiles (by width and eight)

    • Enter your with and jeight: (64, 64)
    • Position: Superimpose
  • Your image will be transformed into a 64x64 stack of layers

  • Crop that image to remove the sides that you don't want
  • Reconstruct the sprite sheet withLayer>Tiles>Join tiles

    • Row/Columns: Parse layer names
    • Final image: Flatten to single layer

enter image description here

  • Filter>Render>Pattern>Grid to add a border to your cells (here: offsets=(-1,-1) and widths=(2,2))

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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