Both sides previous revision
Previous revision
Next revision
|
Previous revision
Last revision
Both sides next revision
|
img2tile [2020/09/01 00:17] spotlessmind1975 [LARGE TILES] |
img2tile [2020/10/18 11:28] spotlessmind1975 |
===== INTRODUCTION ===== | ===== INTRODUCTION ===== |
| |
This page does not want to replace the software user manual (for that there is the [[https://github.com/spotlessmind1975/img2tile/blob/master/README.md|README]]) but to provide some indications on its operation, as well as to explain some of the algorithms used. | This page does not want to replace ''[[https://github.com/spotlessmind1975/img2tile|img2tile]]'' user manual (for that there is the [[https://github.com/spotlessmind1975/img2tile/blob/master/README.md|README]]) but to provide some indications on its operation, as well as to explain some of the algorithms used. It give, also, an example using the [[:midres_library|midres library]] primitives. |
| |
{{ ::diagrammi-img2tile.png?nolink&600 |}} | {{ ::diagrammi-img2tile.png?nolink&600 |}} |
| |
| ===== PREPARING IMAGES ===== |
| |
| {{ ::img2tile-gimp.jpg?nolink&600 |}} |
| |
| Images can be prepared with any photo editing program, such as [[https://www.gimp.org/|GIMP]]. The images must be the size of a tile (8x8 pixels) or a multiple of a single tile (i.e. 32x24 pixel, 64x64 pixel, and so on). Although the program can read many graphic formats, the most accurate results are obtained by using two highly contrasted colors (black / white) and saving using the PNG format at RGB (24 bit) |
| |
===== SMALL TILES ===== | ===== SMALL TILES ===== |
| |
\adsense\ | \adsense\ |
| |
===== MULTIPLE IMAGES ===== | ===== MULTIPLE IMAGES ===== |
| |
{{ ::img2tile-example4.png?nolink |}} | {{ ::img2tile-example4.png?nolink |}} |
| |
| ===== COLORED IMAGES ===== |
| |
| From release 1.14 of the program it is possible to generate multicolor tiles with the ''-m'' option. In this case, what matters is no longer the brightness of each single pixel but the color, intended as RGB. In particular, the option allows you to manage images that have up to 4 colors. |
| |
| {{ :midres_library:tutorial:mctile:mctiles_tutorial_08.png?nolink&600 |}} |
| |
| More information are available in [[:midres_library:tutorial:mctile|this tutorial]], in the section on [[:midres_library:tutorial:mctile:generating_tiles|how to generate multicolor tiles]]. |
| |
===== SYMBOL DEFINITIONS ===== | ===== SYMBOL DEFINITIONS ===== |
| |
img2tile -i airplane.png -i bomb.png -g header_tiles.h -o tiles.bin | img2tile -i airplane.png -i bomb.png -g header_tiles.h -o tiles.bin |
| |
| ===== A SIMPLE PROGRAM ===== |
| |
| This simple program loads all tiles prepared with the last ''img2tile'' command, and it draws a yellow bomb at the center of the default screen: |
| |
| #include "midres.h" |
| #include "header_tiles.h" |
| |
| mr_tileset_load("tiles.bin", MR_TILESET_0, TILE_START, TILE_COUNT); |
| mr_tileset_visible(MR_TILESET_0); |
| mr_puttile(MR_SCREEN_DEFAULT, MR_SCREEN_WIDTH >> 1, MR_SCREEN_HEIGHT >> 1, TILE_BOMB, MR_COLOR_YELLOW); |
| |
| |
| |
| [[:midres_library|{{::midres-logo.png?600 |MIDRES - an isomorphic gamelib}}]] |
| |