1RGBGFX(1)                 BSD General Commands Manual                RGBGFX(1)
2

NAME

4     rgbgfx — Game Boy graphics converter
5

SYNOPSIS

7     rgbgfx [-CDhmuVv] [-f | -F] [-a attrmap | -A] [-d depth] [-o out_file]
8            [-p pal_file | -P] [-t tilemap | -T] [-x tiles] file
9

DESCRIPTION

11     The rgbgfx program converts PNG images into the Nintendo Game Boy's pla‐
12     nar tile format.
13
14     The resulting colors and their palette indices are determined differently
15     depending on the input PNG file:
16
17     -       If the file has an embedded palette, that palette's color and
18             order are used.
19
20     -       If not, and the image only contains shades of gray, rgbgfx maps
21             them to the indices appropriate for each shade.  Any undetermined
22             indices are set to respective default shades of gray.  For exam‐
23             ple: if the bit depth is 2 and the image contains light gray and
24             black, they become the second and fourth colors, and the first
25             and third colors get set to default white and dark gray.  If the
26             image has multiple shades that map to the same index, the palette
27             is instead determined as if the image had color.
28
29     -       If the image has color (or the grayscale method failed), the col‐
30             ors are sorted from lightest to darkest.
31
32     The input image may not contain more colors than the selected bit depth
33     allows.  Transparent pixels are set to palette index 0.
34

ARGUMENTS

36     Note that options can be abbreviated as long as the abbreviation is unam‐
37     biguous: --verb is --verbose, but --ver is invalid because it could also
38     be --version.  The arguments are as follows:
39
40     -a attrmap, --attr-map attrmap
41             Generate a file of tile mirroring attributes for OAM or (CGB-
42             only) background tiles.  For each tile in the input file, a byte
43             is written representing the dimensions that the associated tile
44             in the output file should be mirrored.  Useful in combination
45             with -m to keep track the mirror direction of mirrored duplicate
46             tiles.
47
48     -A, --output-attr-map
49             Same as -a, but the attrmap file output name is made by taking
50             the input filename, removing the file extension, and appending
51             .attrmap.
52
53     -C, --color-curve
54             Use the color curve of the Game Boy Color when generating pal‐
55             ettes.
56
57     -D, --debug
58             Debug features are enabled.
59
60     -d depth, --depth depth
61             The bit depth of the output image (either 1 or 2).  By default,
62             the bit depth is 2 (two bits per pixel).
63
64     -f, --fix
65             Fix the input PNG file to be a correctly indexed image.
66
67     -F, --fix-and-save
68             Same as -f, but additionally, the supplied command line parame‐
69             ters are saved within the PNG and will be loaded and automati‐
70             cally used next time.
71
72     -h, --horizontal
73             Lay out tiles horizontally rather than vertically.
74
75     -m, --mirror-tiles
76             Truncate tiles by checking for tiles that are mirrored versions
77             of others and omitting these from the output file.  Useful with
78             tilemaps and attrmaps together to keep track of the duplicated
79             tiles and the dimension mirrored.  Tiles are checked for horizon‐
80             tal, vertical, and horizontal-vertical mirroring.  Implies -u.
81
82     -o out_file, --output out_file
83             The name of the output file.
84
85     -p pal_file, --palette pal_file
86             Output the image's palette in standard GBC palette format: bytes
87             (8 bytes for two bits per pixel, 4 bytes for one bit per pixel)
88             containing the RGB15 values in little-endian byte order.  If the
89             palette contains too few colors, the remaining entries are set to
90             black.
91
92     -P, --output-palette
93             Same as -p, but the palette file output name is made by taking
94             the input PNG file's filename, removing the file extension, and
95             appending .pal.
96
97     -t tilemap, --tilemap tilemap
98             Generate a file of tile indices.  For each tile in the input
99             file, a byte is written representing the index of the associated
100             tile in the output file.  Useful in combination with -u or -m to
101             keep track of duplicate tiles.
102
103     -T, --output-tilemap
104             Same as -t, but the tilemap file output name is made by taking
105             the input filename, removing the file extension, and appending
106             .tilemap.
107
108     -u, --unique-tiles
109             Truncate tiles by checking for tiles that are exact duplicates of
110             others and omitting these from the output file.  Useful with
111             tilemaps to keep track of the duplicated tiles.
112
113     -V, --version
114             Print the version of the program and exit.
115
116     -v, --verbose
117             Verbose.  Print errors when the command line parameters and the
118             parameters in the PNG file don't match.
119
120     -x tiles, --trim-end tiles
121             Trim the end of the output file by this many tiles.
122

EXAMPLES

124     The following will take a PNG file with a bit depth of 1, 2, or 8, and
125     output planar 2bpp data:
126
127           $ rgbgfx -o out.2bpp in.png
128
129     The following creates a planar 2bpp file with only unique tiles, and its
130     tilemap out.tilemap:
131
132           $ rgbgfx -T -u -o out.2bpp in.png
133
134     The following creates a planar 2bpp file with only unique tiles
135     accounting for tile mirroring and its associated tilemap out.tilemap and
136     attrmap out.attrmap:
137
138           $ rgbgfx -A -T -m -o out.2bpp in.png
139
140     The following will do nothing:
141
142           $ rgbgfx in.png
143

BUGS

145     Please report bugs on GitHub:
146           https://github.com/gbdev/rgbds/issues.
147

SEE ALSO

149     rgbds(7), rgbasm(1), rgblink(1), rgbfix(1), gbz80(7)
150

HISTORY

152     rgbgfx was created by stag019 to be included in RGBDS.  It is now main‐
153     tained by a number of contributors at .:
154           https://github.com/gbdev/rgbds
155
156BSD                            December 5, 2019                            BSD
Impressum