Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert selection to a row of tiles
#1
Question 
I'm writing a game for the open source Uzebox games console. Its tile conversion program expects the input to be one row of 8x8 pixel tiles. Currently, I have to prepare the graphics working by an 8x8 grid and then manually cut the sprites and other graphical resources into individual 8x8 tiles and then manually move each tile into a single horizontal row to keep the tile conversion program happy. Pretty tedious stuff.

This process would be much easier if there was a GIMP plugin to automate most of this process by turning a rectangular GIMP selection into a new image composed of a single horizontal row of (8x8, or whatever the user specifies) tiles.

https://github.com/Saiapatsu/random-tiling

Does such a plugin already exist?

Thanks!

uzebox.org
Reply
#2
I have two plugins that handle tiles/spritesheets
  • ofn-tiles loads/saves individual file images into a single bigger image in Gimp
  • ofn-layer-tiles joins/splits several individual layers (overlapping in a stack or side by side) to/from a single image layer.
Both with many options to figure out number of lines/columns and naming the tiles.

Both scripts can be found here.

PS: Both are written in Python and since you are on Linux you may be missing Python support. But there are several ways to have an up-to-date Gimp with Pythin support in Linux.
Reply
#3
My first thought was Ofnuts plugins which goes like this: https://i.imgur.com/bj8B9Dk.mp4

If you do not have python support and the ease of a fix here depends on distro - you should tell us what you are using. It can be done using guides and splitting up the image into layers.

Two addons for that, a script for the guides guides-grid.scm and a compiled plugin, guillotine-into-layersx64 The latter quite old, might work with your linux or might not.

A bit tedious but quick
Set up a grid of guides
Split that up into layers
Invert the layer stack
Space out with the align tool
Image -> Fit canvas to layers followed by Merge layers.

Another 50 second demo https://i.imgur.com/qioYhxN.mp4

Just in case you want to give that a try, the script and plugin attached.


Attached Files
.zip   guides_and_guillotine.zip (Size: 7.12 KB / Downloads: 74)
Reply
#4
Rich: Yes, thats what I'm trying to do.

Sorry I should've mentioned I'm running Debian Testing / GIMP 2.10. Debian Testing doesn't package python2 any more which I think is required to run any/all of the those ofn plugins. I'd probably have to build python2 from source and rebuild GIMP with pygtk support to use those ofn plugins, would I?

It might be easier to use the Windows version of GIMP under wine? I've not tried that yet.

Can anyone think of an easy way to do this without using any python GIMP plugins?

I asked chatgpt if it could write me a GIMP scheme plugin to do this but it didn't quite work:

http://uzebox.org/forums/viewtopic.php?f=3&t=11222

EDIT:

It seems Image -> Slice using guides might be what I need to use?

EDIT 2

Maybe but there doesn't seem to be an automated way to add new guides at intervals, they have to be calculated and created individually it seems.

I'd like a method that doesn't involve using wine or windows to use python plugins.
Reply
#5
(02-18-2023, 09:15 PM)danboid Wrote: Rich: Yes, thats what I'm trying to do.

Sorry I should've mentioned I'm running Debian Testing / GIMP 2.10. Debian Testing doesn't package python2 any more which I think is required to run any/all of the those ofn plugins. I'd probably have to build python2 from source and rebuild GIMP with pygtk support to use those ofn plugins, would I?

It might be easier to use the Windows version of GIMP under wine? I've not tried that yet.

Can anyone think of an easy way to do this without using any python GIMP plugins?

I asked chatgpt if it could write me a GIMP scheme plugin to do this but it didn't quite work:

http://uzebox.org/forums/viewtopic.php?f=3&t=11222

EDIT:

It seems Image -> Slice using guides might be what I need to use?

EDIT 2

Maybe but there doesn't seem to be an automated way to add new guides at intervals, they have to be calculated and created individually it seems.

I'd like a method that doesn't involve using wine or windows to use python plugins.

You can install Gimp as a flatpak or as an AppImage. IIRC they come with Python built-in.

Otherwise I also have a script that allows you to use predefined sets of guides (that you can even attach to a keyboard shortcut).
Reply
#6
Quote:...snip...Maybe but there doesn't seem to be an automated way to add new guides at intervals, they have to be calculated and created individually it seems....

....but that is what rhe grid-of-guides.scm script-fu does and does not depend on python. Same with the compiled plugin (if it works with Debian testing.) 50 second demo https://i.imgur.com/qioYhxN.mp4

First stop for python support is a small appimage:

Gimp-python appimage:

https://github.com/TasMania17/Gimp-Appim...-for-Linux

Try the one for ubuntu. Run it, if it works, it it starts the Gimp installation with python support. That is the one I use. (kubuntu 22.04)

The other appimage way is a full blown Gimp 2.10.22 (167 MB)
https://github.com/aferrero2707/gimp-app...4.AppImage and that will require fuse (fuse2) installed.

If you do not mind bloat and a sandboxed version then get the flatpak.

Windows Gimp in Wine ? Long time since I tried that, it was very flakey. For Windows Gimp, if you can get one is a Windows VirtualBox. Win7 will do.
Reply
#7
Thanks Rich!

It seems I've almost got this to work now but it goes wrong for me at the last step when I click on "Distribute right edges of targets". For some reason, all of my layers seem to go blank as soon as I push it. Because my tiles are 8x8 pixels, I set the Offset X value to 8 and Offset Y to 0 before I push the distribute right edges button.

I can upload a video if you can't guess what I'm doing wrong.

Here's a video of my issue:

https://youtu.be/FKhOJGwzOtU

BTW that character wasn't propery aligned to a grid, I realise that. I just wanted to test the process out with something.
Reply
#8
The align tool, not one of my favourites, but.. screenshots of the steps merged into one ( Edit: Forgot to invert the layer stack Wink )

   

(1) Is the layer stack, rubber banded to give those corner marks.
(2) Is the align tool applied, based on the image (canvas). Anything off the canvas is normally 'invisible'
(3) Just for info and useful to know, View -> Show All , will display layers that are off the canvas. It does not do anything except that.
(4) To get a strip and lose that 'first canvas' apply Image -> Fit canvas to layers and then to get a single layer Image -> Merge Visible layers. Also turned View All off.

Edit: Just had a look at your video. For that appimage launcher try out. I would go for the ubuntu version rather than the MX version. Also looks like you need fuse (fuse2) installed. That will replace fuse3, it is up to you. The other option is the flatpak.
Reply
#9
Great! I've got it now.

Thanks very much for your help Rich! I'm going to document this process on the Uzebox wiki.

GIMP is one of the top programs I really should get to know better. Which tutorial videos do you recommend?
Reply
#10
(02-19-2023, 11:06 AM)danboid Wrote: Great! I've got it now.

Thanks very much for your help Rich! I'm going to document this process on the Uzebox wiki.

GIMP is one of the top programs I really should get to know better. Which tutorial videos do you recommend?

I do very specific short (< 5 minutes) youtube videos. I think the general Gimp Basics 101 type too long or too BS-ish

The best starting point is the Gimp help pages and if you do not want to install help you can get it as a PDF 
https://gimp.linux.it/www/meta/gimp-help-2.10-en.pdf
Reply


Forum Jump: