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 details)

Uploaded Source

File details

Details for the file img2gb-0.9.0.tar.gz.

File metadata

  • Download URL: img2gb-0.9.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for img2gb-0.9.0.tar.gz
Algorithm Hash digest
SHA256 1a0acc2cba8957d6a5fb6d127ca95caaf98c176f6aded35a8e274cbf2d5920b8
MD5 387f9d4d09493ac1421b0e23a628f79b
BLAKE2b-256 ce91ed881e6d1b31852f06532fa04470c04e8cb1e5e526f48d27089387ea217d

See more details on using hashes here.

Supported by

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