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.1: Fixes an issue with Python 3

  • 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.1.tar.gz (4.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: img2gb-0.9.1.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.1.tar.gz
Algorithm Hash digest
SHA256 aa56582321e44b329330495a4b31e50a1adb9ab69e8a1a0914968ecae6a091c2
MD5 6dc1adf8efc31e4bfdf7c760c8bd869c
BLAKE2b-256 8513cb179653670e7720545c5c93554e7381987ae7e954f556cfcb07bf9bcb8f

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