Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2019-06-14 09:35:02

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

Here's a Gimp plugin I wrote that can load/save GBTD and GBMB files, as well as export to C source. I finally had time to go back and build a Windows binary in addition to the Linux one.

It will do tile de-duplication when exporting to GBMB.
UPDATE: There is full CGB / 32 color import/export support now
UPDATE: Added console tool: png2gbtiles (Linux & Windows)

Feedback is welcome, though I may not  work on it for a while since it meets my needs right now.

https://raw.githubusercontent.com/bbbbbr/gimp-tilemap/master/info/gimp-tilemap-plugin-screenshot.png

More details here:
https://github.com/bbbbbr/gimp-tilemap-gb

Last edited by bbbbbr (2020-04-25 15:31:29)

Offline

 

#2 2019-06-14 14:59:21

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

This is awesome!. The only bad thing about it is there is no cgb support.  I'll test it later. Thanks a lot!

Offline

 

#3 2019-06-15 15:04:37

ben0910
Member
Registered: 2019-04-21
Posts: 12

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

This is great! The more tools like this the better!

Mills, if you are looking for a tool that can produce gbc maps and tiles. I am working on one now. It is fully functional but has no documentation yet. If you are interested in testing it i would be happy to give you a live demo. http://thegameboys.io/tile-map-editor (auto tile de-duping, individual tile fixer, global color mapping tool, save palettes, save color maps)

Last edited by ben0910 (2019-06-15 15:06:51)

Offline

 

#4 2019-07-15 09:02:39

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

I finally tested the plugin, (I had to install last GIMP version for windows, 2.10.12).

It works very well, and I found it very useful to convert images straight to gbm maps and gbr tiles (Opimization worked great).

Offline

 

#5 2019-07-17 09:44:46

Ardis
Member
From: USA
Registered: 2019-06-06
Posts: 58
Website

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

Neat. I'll give this a try later.


Also known as Arvex in other places.

Interceptor (Demo)
https://arvex.itch.io/interceptor

Offline

 

#6 2020-03-22 10:32:23

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

Update: The plugin now supports CGB import.

No export yet since that's more complicated.

Offline

 

#7 2020-04-16 19:51:21

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

Another update. Hopefully the last on this tool for a while. smile

* CGB Export is now supported
* Optional Tile deduplication on flip x/y and alternate palette for the GBM map export
* You can turn off Tile deduplication entirely now, if needed.

* GBMB/GBTD Export Settings are now preserved across GIMP import/export (and will get embedded in the GIMP XCF file if the image is stored that way).

Last edited by bbbbbr (2020-04-16 19:52:31)

Offline

 

#8 2020-04-17 01:27:03

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

So does this fully create palettes and stuff? How do you handle the hardware limitations, I mean:
- What happens if the whole image has more than 8 palettes?
- What happens if there are more than 4 different colors in an 8x8 tile?

Also... how hard would it be to make this gimp independant?

Offline

 

#9 2020-04-17 12:28:42

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

Zalo wrote:

So does this fully create palettes and stuff? How do you handle the hardware limitations, I mean:
- What happens if the whole image has more than 8 palettes?
- What happens if there are more than 4 different colors in an 8x8 tile?

Also... how hard would it be to make this gimp independant?

Probably not hard. It would just require a different front end which produces and consumes indexed color images. The Integration with GIMP is limited to the top layer. While the code is a little sloppy it has decent logical separation.

Do you have a particular use case in mind?

CGB Stuff:
Yeah, it creates all the GBR and GBM palettes and detects/maps them accordingly per tile and per-BG map entry.

* Images with palette sizes larger than 32 colors are not allowed for CGB export mode (4 colors for DMG export). This is true even if the extra colors in the indexed color palette are unused. An error will be displayed.
* If more than one palette is detected per tile then an error will be displayed.

The plugin leaves palette management up to the user. It expects them to be arranged in the same way as on the CGB: linearly ordered groups of 4 colors. That makes it easy to do :

Strip indexed color: Pixel =  PixelColor % 4
Palette ID = int(Pixel Color / 4)

By design it avoids rearranging and optimizing the palette. That makes moving back and forth between the plug-in, GBTD/GBMB and code easier.

Last edited by bbbbbr (2020-04-17 12:34:05)

Offline

 

#10 2020-04-20 08:10:42

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

bbbbbr wrote:

Do you have a particular use case in mind?

Yes, I was thinking if this could be used as a standalone program. Passing an image in .png format
I recently included pngb https://github.com/Zal0/pngb in ZGB but this will be much better

Offline

 

#11 2020-04-21 16:11:43

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

As a test to see how it would go I hacked them together. The result is here:
https://github.com/bbbbbr/pngb/commits/feature_gbmb

* Only the linux binary is recompiled
* The glue layer is "tilemap_actions.c" in src/
* The files imported from the GIMP plugin are under tilemap_gb/
* Changed the Makefile to use wildcards since I needed to add a lot of source files (just a temporary solution)

Since this is just a test so far, the output is hardwired to GBM. Changing that is a matter of connecting the command line arguments to the "options" variable in tilemap_process_image() of "tilemap_actions.c".

Is your primary interest in C source output, GBR/GBM output, or both?

I noticed the C source output (which I haven't used or tested for a long time) is lacking palette output and CGB Map per-entry attributes. Those shouldn't be particularly difficult to add, though they are low on my priorities right now.

Also note the Usage / Cautions & Limitations described here if you haven't already :
https://github.com/bbbbbr/gimp-tilemap-gb

Offline

 

#12 2020-04-22 05:29:18

Zalo
Member
From: Spain
Registered: 2016-07-26
Posts: 103
Website

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

GBR/GBM output is what I need. I export to C from some tools I created

Thanks for the commits, now I need some time to check all this smile

Offline

 

#13 2020-04-22 16:35:59

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

On further review: To make the output easier to use the gbr/gbm export should probably populate useful defaults for gbm.map_export_prop  and gbr.tile_export records. Right now it only populates them with minimal settings, or any settings that were cached from a previous import.

I've been using imported settings in my work, but they won't be present on conversion straight from a PNG.

I'll look into this: https://github.com/bbbbbr/gimp-tilemap-gb/issues/4

I just took a look at your GBR/GBM tools. Nice. smile I also didn't realize there were docs on the formats! I've just been reading the GBTD/GBMB source code, which can be a little mysterious sometimes. Haha.

(By the way, when debugging GBR/GBM file import and export these "grammars" for Hexinator are useful. They're not 100% complete, but are good enough for most testing: https://github.com/bbbbbr/gimp-tilemap- … ster/tools )

https://i.postimg.cc/Vrvxsr12/Hexinator-GBR-Screenshot.png

Last edited by bbbbbr (2020-04-22 17:19:31)

Offline

 

#14 2020-04-24 21:09:21

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

The more I thought about it, the more useful it seemed to have a standalone command line version.

Here's a second attempt. It's not based on "pngb" so the console wrapper code is simpler. It's also now just a sub-project of the GIMP plugin that builds off the main code.

Update: Added Windows and Linux binaries

https://github.com/bbbbbr/gimp-tilemap- … er/console

Last edited by bbbbbr (2020-04-25 15:33:40)

Offline

 

#15 2021-07-19 22:07:19

bbbbbr
Member
Registered: 2019-03-04
Posts: 124

Re: GIMP plugin (+Console tool) to load/save GBTD tiles and GBMB map files

There's a new release with some improvements:

https://github.com/bbbbbr/gimp-tilemap-gb/releases

* GIMP plugin (gimp-file-tilemap)

Added control of tile size: (8x8, 8x16, 16x16, 32x32)
Added remapping images (8 bit indexed and 24/32 bit RGB) to a user-defined palette (or the image's own palette)
- Previously only 8 bit indexed color images were supported
- Useful for "repairing" CGB per-tile sub-palette errors

* Console (png2gbtiles)

Added remapping images (8 bit indexed and 24/32 bit RGB) to a user-defined palette.
  -pal=[file]
  - Previously only 8 bit indexed color images were supported
  - Useful for "repairing" CGB per-tile sub-palette errors
Added control of tile size: (8x8, 8x16, 16x16, 32x32)
  -tilesz=[size]
Added base name to use for export variables (otherwise filename)
  -var=[name]
Added set bank number for all output modes (including .gbm and .gbr export defaults)
  -bank=[num]
Added tile index offset for maps (instead of zero). For example, loading the map tiles starting at Tile Index 20 in VRAM.
  -tileorg=[num]
Bonus: Added converting .gbm and .gbr files into .png files (8 bit indexed)
   Use the -png argument

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson