1RGBGFX(1) BSD General Commands Manual RGBGFX(1)
2
4 rgbgfx — Game Boy graphics converter
5
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
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 or‐
18 der 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
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 in column-major order (column by column), instead
74 of the default row-major order (line by line). Especially useful
75 for "8x16" OBJ mode, if the input image is 16 pixels tall.
76
77 -m, --mirror-tiles
78 Truncate tiles by checking for tiles that are mirrored versions
79 of others and omitting these from the output file. Useful with
80 tilemaps and attrmaps together to keep track of the duplicated
81 tiles and the dimension mirrored. Tiles are checked for horizon‐
82 tal, vertical, and horizontal-vertical mirroring. Implies -u.
83
84 -o out_file, --output out_file
85 The name of the output file.
86
87 -p pal_file, --palette pal_file
88 Output the image's palette in standard GBC palette format: bytes
89 (8 bytes for two bits per pixel, 4 bytes for one bit per pixel)
90 containing the RGB15 values in little-endian byte order. If the
91 palette contains too few colors, the remaining entries are set to
92 black.
93
94 -P, --output-palette
95 Same as -p, but the palette file output name is made by taking
96 the input PNG file's filename, removing the file extension, and
97 appending .pal.
98
99 -t tilemap, --tilemap tilemap
100 Generate a file of tile indices. For each tile in the input
101 file, a byte is written representing the index of the associated
102 tile in the output file. Useful in combination with -u or -m to
103 keep track of duplicate tiles.
104
105 -T, --output-tilemap
106 Same as -t, but the tilemap file output name is made by taking
107 the input filename, removing the file extension, and appending
108 .tilemap.
109
110 -u, --unique-tiles
111 Truncate tiles by checking for tiles that are exact duplicates of
112 others and omitting these from the output file. Useful with
113 tilemaps to keep track of the duplicated tiles.
114
115 -V, --version
116 Print the version of the program and exit.
117
118 -v, --verbose
119 Verbose. Print errors when the command line parameters and the
120 parameters in the PNG file don't match.
121
122 -x tiles, --trim-end tiles
123 Trim the end of the output file by this many tiles.
124
126 The following will take a PNG file with a bit depth of 1, 2, or 8, and
127 output planar 2bpp data:
128
129 $ rgbgfx -o out.2bpp in.png
130
131 The following creates a planar 2bpp file with only unique tiles, and its
132 tilemap out.tilemap:
133
134 $ rgbgfx -T -u -o out.2bpp in.png
135
136 The following creates a planar 2bpp file with only unique tiles
137 accounting for tile mirroring and its associated tilemap out.tilemap and
138 attrmap out.attrmap:
139
140 $ rgbgfx -A -T -m -o out.2bpp in.png
141
142 The following will do nothing:
143
144 $ rgbgfx in.png
145
147 Please report bugs on GitHub: https://github.com/gbdev/rgbds/issues
148
150 rgbds(7), rgbasm(1), rgblink(1), rgbfix(1), gbz80(7)
151
153 rgbgfx was created by stag019 to be included in RGBDS. It is now main‐
154 tained by a number of contributors at https://github.com/gbdev/rgbds
155
156BSD March 28, 2021 BSD