kanzure/pokemon-reverse-engineering-tools — pull request #71 by yenatch (2014-03-29 19:58:23+00:00)
Title: Image metadata and simpler gfx.py usage

##### gfx.py gets a facelift

Before (only one file at a time):
```bash
gfx.py png-to-2bpp filename.png; gfx.py 1bpp-to-2bpp filename.1bpp
gfx.py png-to-1bpp filename.png; gfx.py 2bpp-to-1bpp filename.2bpp
gfx.py 1bpp-to-png filename.1bpp; gfx.py 2bpp-to-png filename.2bpp
gfx.py png-to-lz filename.png; gfx.py 2bpp-to-lz filename.2bpp
gfx.py lz-to-png filename.lz; gfx.py lz-to-2bpp filename.lz
...
```
Now (any number of files):
```bash
gfx.py 2bpp [filename.{1bpp,png} [...]]
gfx.py 1bpp [filename.{2bpp,png} [...]]
gfx.py png [filename.{1bpp,2bpp} [...]]
gfx.py unlz [filename.lz [...]]
gfx.py lz [filename [...]]
```

---

##### image metadata

Images created in tile editors don't have the same restrictions as conventional image formats like png. For seamless conversion, the restrictions must be consistent. These vary between images.

Image metadata is contained in the filename, so as to not create additional files or modify existing content.

--

Dimensions can be forced. Non-rectangular pngs are padded with empty tiles.
```bash
gfx/misc/footprints.w128.1bpp gfx/misc/footprints.h512.1bpp # identical
gfx/title/logo.w160.2bpp.lz # implicit padding
gfx/title/logo.w160.t4.2bpp.lz # explicit padding (removed on the return trip)
```
--
Since arbitrary data can be lz-compressed (like tilemaps), the source extension remains.
```bash
tilesets/kanto.2bpp.lz ↔ tilesets/kanto.2bpp ↔ tilesets/kanto.png
gfx/intro/1.tilemap.lz ↔ gfx/intro/1.tilemap
pokecrystal.gbc.lz.lz ↔ pokecrystal.gbc.lz ↔ pokecrystal.gbc
```
--
Frontpics are now a single image.
Transposed images are specced given tile dimensions. Remaining tiles are appended normally.
```bash
gfx/pics/bulbasaur/front.5x5.2bpp.lz
gfx/pics/bulbasaur/back.6x6.2bpp.lz
gfx/misc/dude.6x6.2bpp.lz
```
--
Graphics for 8x16 sprites can be row-interleaved.
```bash
gfx/title/crystal.interleave.2bpp.lz
```