Skip to main content

Converts images to GameBoy tileset

Project description

./banner.png

Dependencies

  • Python 2.7 / 3.5

  • Pillow

Install

From Sources

Clone this repository:

git clone https://github.com/flozz/img2gb.git

Go the the project repository:

cd img2gb

Then install the software (as root):

python setup.py install

From PYPI

Run the following command (as root):

pip install img2gb

Windows Binary

Will be available soon ;)

Usage

usage: img2gb [-h] [-H HEADER_FILE] [-m] [-d] [-n NAME] image c_file

Converts images to GameBoy tiles

positional arguments:
  image                 Input image file
  c_file                Ouput C File

optional arguments:
  -h, --help            show this help message and exit
  -H HEADER_FILE, --header-file HEADER_FILE
                        Output file for C Header (.h)
  -m, --map             Add tilemap to the .c / .h files
  -d, --deduplicate     Remove duplicated tiles from the tileset
  -n NAME, --name NAME  Name of the tileset (used for variable names in
                        generated code, default=TILESET)

Examples:

img2gb tileset.png tileset.c
img2gb tileset.png tileset.c -H tileset.h
img2gb --deduplicate --name MY_TILESET_01 tileset.png tileset.c -H tileset.h

Example Generated Code

Command:

img2gb --map --name TILESET img.png tileset.c -H tileset.h

img.png:

./img.png

tileset.h:

// This file was generated by img2gb, DO NOT EDIT

#ifndef _TILESET_H
#define _TILESET_H

extern const UINT8 TILESET[];
#define TILESET_TILE_COUNT 97

extern const UINT8 TILESET_MAP[];
#define TILESET_MAP_WIDTH 20
#define TILESET_MAP_HEIGHT 18

#endif

tilset.c (truncated):

// This file was generated by img2gb, DO NOT EDIT

#include <types.h>

const UINT8 TILESET[] = {
    0xFF, 0x00, 0xFF, 0x00, // ...
};

const UINT8 TILESET_MAP[] = {
    0x00, 0x00, 0x00, 0x00, // ...
};

Changelog

  • 0.9.0: Initial release (generates tiles, tilesets and tilemaps)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img2gb-0.9.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page