gconvert png converter, utracker

This forum is for artists to post their music and graphics or discuss artistic matters that could be used in Uzebox games.
Post Reply
User avatar
danboid
Posts: 238
Joined: Sun Jun 14, 2020 12:14 am

gconvert png converter, utracker

Post by danboid » Sun Sep 11, 2022 8:34 pm

gconvert is very fussy about the png files it accepts as input, they must be "PNG-8 with a 256 colors palette".

Has anyone written a script (for imagemagick or ffmpeg maybe), a GIMP plugin or an app than can convert a PNG of any bit depth to a PNG file that gconvert will accept as input that does a best effort job on converting the input image to use the UB's palette?

You can use a command like this to brute force the conversion of the file format, ignoring the UBs specific palette:

Code: Select all

convert maze1-rgb.png +dither -colors 256 PNG8:maze1.png
but I'd like to see something better than that. Does it already exist? Maybe gconvert could eventually get updated with the option to do this, that'd be ideal!

Whilst I'm talking about UB dev apps, I've noticed utracker is missing from:

http://uzebox.org/wiki/Main_Page#Tools

I've not tried utracker yet but it can be downloaded on the forum.

viewtopic.php?f=3&t=9967&hilit=tracker

Is that the easiest way to write music for the UB soundchip, presuming it works well enough, for people who don't have a physical UB with a MIDI port? utracker is a VB6 app so I'd be running it in wine, which isn't ideal.

The tools page suggests Milkytracker but I don't think that has any specific UB support. You'd have to convert your .mod or .s3m into a MIDI file and then convert that into code that can you used in your UB game as I understand it. That's not a great workflow.

User avatar
danboid
Posts: 238
Joined: Sun Jun 14, 2020 12:14 am

Re: gconvert png converter, utracker

Post by danboid » Tue Sep 13, 2022 6:56 pm

This guide covers how to convert an image to use the UB palette ( uzebox/gfx/uzebox.act ) manually using the GIMP:

https://documentation.help/Microchip-Gr ... _GIMP.html

Its a bit of a tedious process if you need to do it several times so it'd be great to see this get scripted or added to gconvert.

User avatar
danboid
Posts: 238
Joined: Sun Jun 14, 2020 12:14 am

Re: gconvert png converter, utracker

Post by danboid » Tue Sep 13, 2022 8:27 pm

It doesn't seem that imagemagick can directly use .act files to convert non 8 bit images but you can feed `convert` an image containing all 256 UB colours and the use its `-remap` option. I've not tried it yet but it sounds promising.

https://legacy.imagemagick.org/Usage/quantize/#remap

User avatar
nicksen782
Posts: 695
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: gconvert png converter, utracker

Post by nicksen782 » Wed Sep 14, 2022 2:42 am

I never did figure out how .act files worked or any of that. Gconvert is picky. I made this some years ago and I still use it. It outputs nicely formatted .inc files for graphics and has some other features too. It isn't picky about the png format other than the tileWidth and tileHeight being compatible with the width and height of the image.

It probably needs an update (mega-tiles?) but it still works.

https://nicksen782.net/UAM/APP_gconvert/gc.html

User avatar
danboid
Posts: 238
Joined: Sun Jun 14, 2020 12:14 am

Re: gconvert png converter, utracker

Post by danboid » Mon Sep 19, 2022 12:14 pm

Have you considered updating your javascript version to add the option to remap the palette (using convert/magemagick)?

User avatar
nicksen782
Posts: 695
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: gconvert png converter, utracker

Post by nicksen782 » Mon Sep 19, 2022 6:15 pm

The program reduces the source image colors to the Uzebox colors, breaks the image down into tiles and compares each of them to determine which are actually used by a tilemap and which are duplicate tiles. Then, it creates a reduced tileset (new tile ids) and creates the tilemaps from those tile ids. The last part of the processing shows visually which tiles are duplicates (they are drawn grayed out) and the output text is on the right.

Currently no image processing happens by the server so no convert/imagemagick. That does seem like a slick idea though. But, if it is simple color replacements that you need then gconvertJs could probably be updated to pre-process the source image to the replacement colors. (ex: colorA becomes colorB.) Is that what you are asking for? If so, it's a good idea.

I usually do my graphics editing in GIMP and you can swap colors there too so I'm not sure that gconvertJs NEEDS to do that. Of course, if you aren't using a nicer graphics editor then I guess it would be helpful.

User avatar
danboid
Posts: 238
Joined: Sun Jun 14, 2020 12:14 am

Re: gconvert png converter, utracker

Post by danboid » Mon Sep 19, 2022 7:35 pm

What I'm suggesting is that, at present, if I was to try and feed gconvertJS a 24/32 bit RGB PNG it would likely error. I would like a option to avoid that bitdepth related error by using converts -remap feature to gracefully degrade the image to use the UB's specific palette that gconvert can use.

I have just tried to use gconvertJS for the first time but I didn't get very far. When you paste your xml in the INPUT XML window, what file name am I supposed to use for the input filename?

I would suggest that after the user has loaded a png, the filename should get displayed in the input area and a xml template should get generated with the correct input file name in place and some other minimal boilerplate xml.

User avatar
Artcfox
Posts: 1083
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: gconvert png converter, utracker

Post by Artcfox » Tue Sep 20, 2022 2:31 am

You only have to setup the Uzebox color palette once in GIMP, and then you can just convert the image to indexed, select the palette, and you should be good.

I demonstrate how to do it in part 2 of my video tutorial here (Jump to 7:10 to get right to the palette part): https://youtu.be/SRUv9T9vyQ4?list=PLmw_ ... 5Dsk&t=425

You can probably even script it using gimp-fu, similar to how when Debian removed xcf2png from its repositories I resorted to duplicating its functionality using a gimp-fu script which I then call from a bash script for rebuilding all of the assets from scratch for Bugz. Here is my bash gimp replacement for xcf2png: https://github.com/artcfox/bugz/blob/ma ... mp-xcf2png

User avatar
nicksen782
Posts: 695
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: gconvert png converter, utracker

Post by nicksen782 » Thu Sep 22, 2022 5:37 pm

danboid wrote:
Mon Sep 19, 2022 7:35 pm
I have just tried to use gconvertJS for the first time but I didn't get very far. When you paste your xml in the INPUT XML window, what file name am I supposed to use for the input filename?
The filename isn't actually important since gconvertJS doesn't actually read files (unless they are saved (left menu)). GconvertJS reads the xml text input and the displayed image. There are examples on the left. The Mario Bros and Megatris examples are probably the best to start with. Oh, if you want to quickly update the source image just copy your source image (gimp, etc) and double-click the source image in gconvertJS and then press CTRL+V. It immediately updates.

I haven't had a ton of input on gconvertJS so of course, I'm technically the "expert" of the program and have long forgotten how a new person would use it (also, I was never technically a "new" user, I was the dev.) An unfortunate problem with being a dev. If it would help, I could make a Youtube demo video of how to use it. Even if old it is a valuable tool and I've even used it for some parts of non-Uzebox graphics programs. (JSGAME, Command-Er Mini, etc.) If it uses tile-based graphics then gconvertJS might be useful.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest