New community dev tool uploaded: Vera Graphics Converter

All aspects of programming on the Commander X16.
Sandmage
Posts: 25
Joined: Mon Jun 22, 2020 7:42 am

New community dev tool uploaded: Vera Graphics Converter

Post by Sandmage »




Vera Graphics Converter




View File






Version 0.1

This software converts indexed and RGBA images in the formats PNG, JPG or GIF into binary data suitable for the VERA chip in the upcoming 8-Bit Computer Commander X16.






Basic usage:


Open an image file using File/Open...

Configure the settings according to your needs.

Export the image using File/Export Bitmap/Tiles/Sprites...






Image Modes:


You can open either an indexed image with an embedded palette or a regular RGBA image.

Depending on the image mode, the software behaves slightly differently.






RGBA:


In RGBA mode, VGC needs to match the pixel colors to the colors in the palette. This can be done by comparing color similarity in RGB (Red, Green, Blue), HSL (Hue, Saturation, Lightness) or HSV (Hue, Saturation, Brightness) mode. Select the conversion strategy that works best for your image. Ideally load a palette that matches all colors in the image.

You can specify the bit depth of the image by changing the pixel mode. 1 Bit per Pixel results in 2 colors, 2 Bits per Pixel result in 4 colors, 4 Bits per Pixel result in 16 colors and 8 Bits per Pixel uses the whole palette of 256 colors.

The colors usable by the image depend on the palette offset.






Indexed:


In indexed mode VGC assumes that all pixels in the image have the correct index. It is still necessary to select the correct palette offset to give a correct export. On export the palette offset is subtracted and the index value capped on the selected pixel mode.






Transparency


Any pixel in the image that has an alpha value of 255 is set to the index selected in "Transparent Color Index". The minimum value is the palette offset.






Image Mode:


The VERA Graphic chip has three modes. Bitmap, tiled with a tile dimension of 8 * 8 pixels and tiled with a tile dimension of 16 * 16 pixels. Both tile modes split the image in separate tiles and limit their number to 256, since the VERA chip cannot address more than 256 tiles. It is also possible to limit their number even further.

To use a tile mode the width and height of your image must be divisible by 8 or 16.

The VERA chips supports 4 different resolutions: 640x480, 320x480, 640x240 and 320x240. VGC does not enforce these resolutions.

It is also possible to generate sprite maps. In sprite mode the tiles can have 8, 16, 32 or 64 pixels in width or height. They are however limited to 128 tiles, and similarly, the source images dimensions have to be divisible by the tile dimensions. Sprites can only have a color depth of 4 or 8 Bits per Pixel.






PRG File Header


It is possible to save the exported binary file with 2 leading bytes. This is necessary for some load routines in the Commander X16 Kernal.






Splitting files


The exported files can be saved in chunks of a given size. The VERA Video RAM is paged in pages of 2048 bytes. Files can be split at any page, depending on how you want to store or load your data. The PRG File Header is saved to every individual file.






The Palette


You can load and save the color palette in the Format used by the Gnu Image Manipulation Program (GIMP)

Other software like Aseprite can read and save this format too.

You can also export the palette in the format used by the VERA chip. The PRG Header option is applied to this as well. The file splitting is not.






Analyzing the image.


You can double click on colors in the palette to change them.

When you hold the left mouse button on a color in the palette, the parts of the image using this color are highlighted.

Similarly, when you click on the image the color in the palette is also highlighted.

 






 
Sandmage
Posts: 25
Joined: Mon Jun 22, 2020 7:42 am

New community dev tool uploaded: Vera Graphics Converter

Post by Sandmage »


I've been working on this for a couple of weeks now. What I originally intented to do is a tool that crunshes images with repeating patterns into a set of tiles and autogenerates a tilemap. Sort of what Ron Gilbert and Gary Winnick did in Maniac Mansion, but with enhanced features like flipping tiles and shifting the color palette. Befor I could have that I need a Tileeditor, and before I can create a Tileeditor I need this. So, this is the first version of what I hope will be a very versatile tool to create assets optimized for the VERA chip.

User avatar
AndyMt
Posts: 326
Joined: Sun Jun 21, 2020 3:02 pm
Location: Switzerland

New community dev tool uploaded: Vera Graphics Converter

Post by AndyMt »


Ooooh - thanks a lot for this one ?! I use a combination of Gimp and Paint.Net and some self-made python scripts which is quite cumbersome. This will help a lot!

Sandmage
Posts: 25
Joined: Mon Jun 22, 2020 7:42 am

New community dev tool uploaded: Vera Graphics Converter

Post by Sandmage »


Let me know what you think and what can be improved. To be honest, I haven't yet tested it that thorougly.

User avatar
AndyMt
Posts: 326
Joined: Sun Jun 21, 2020 3:02 pm
Location: Switzerland

New community dev tool uploaded: Vera Graphics Converter

Post by AndyMt »


I'll dig into it tomorrow (midnight here now). But then I'll need some additional artwork for "Brixx" :).

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

New community dev tool uploaded: Vera Graphics Converter

Post by StephenHorn »


Looks very nice! I'll definitely be trying this out for myself.

I was working on a similar tool, but mine looks incredibly ghetto because UI really isn't my thing. Also, I wound up getting lost in the weeds of editing both tiles and tilemaps, because I wanted to merge multiple similar tiles together. That level of built-in editing turned into a giant headache.

(My test case was a giant star field with nebulae, so of course I had all 16 distinct combinations of "a single 1-pixel star in the 8x8 tile" represented, times every possible star color, times every possible background nebula color. I needed to chew on a less ambitious image.)

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

New community dev tool uploaded: Vera Graphics Converter

Post by StephenHorn »


Oh, by the by:


Quote




since the VERA chip cannot address more than 256 tiles.



This is not true. Well, okay, this is partially true. True if and only if you are using 1bpp tile modes (a.k.a. "text" modes). Other tiled modes (2, 4, and 8bpp) support up to 1024 tiles.

See also:

https://github.com/commanderx16/x16-docs/blob/master/VERA Programmer's Reference.md#tile-mode-248-bpp

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
Sandmage
Posts: 25
Joined: Mon Jun 22, 2020 7:42 am

New community dev tool uploaded: Vera Graphics Converter

Post by Sandmage »


Thanks for pointing that out. I'll release a 1.1 version later today, before I start coding the TileEditor.

Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

New community dev tool uploaded: Vera Graphics Converter

Post by Johan Kårlin »


I think this is a great tool! Easy to use. But what happened to version 1.1? 

Starsickle
Posts: 81
Joined: Mon Aug 31, 2020 12:00 am

New community dev tool uploaded: Vera Graphics Converter

Post by Starsickle »


I tried converting a 640x480 picture, but while the preview image seemed to check out, the resulting file that I saved had a size of 0kb.

Post Reply