shithub: rgbds

ref: c1a97f6541b6a1b0e5144e0bfa4c37ecaf0f7e85
dir: /src/gfx/rgbgfx.1/

View raw version
.\"
.\" This file is part of RGBDS.
.\"
.\" Copyright (c) 2013-2018, stag019 and RGBDS contributors.
.\"
.\" SPDX-License-Identifier: MIT
.\"
.Dd January 26, 2018
.Dt RGBGFX 1
.Os RGBDS Manual
.Sh NAME
.Nm rgbgfx
.Nd Game Boy graphics converter
.Sh SYNOPSIS
.Nm rgbgfx
.Op Fl DfFhPTVv
.Op Fl o Ar outfile
.Op Fl d Ar depth
.Op Fl p Ar palfile
.Op Fl t Ar mapfile
.Op Fl x Ar tiles
.Ar file
.Sh DESCRIPTION
The
.Nm
program converts PNG images into the Nintendo Game Boy's planar tile format.

The resulting colors and their palette indices are determined differently
depending on the input PNG file:
.Bl -dash -width Ds
.It
If the file has an embedded palette, that palette's color and order are used.
.It
If not, and the image only contains shades of gray, rgbgfx maps them to the
indices appropriate for each shade. Any undetermined indices are set to
respective default shades of gray. For example: if the bit depth is 2 and the
image contains light gray and black, they become the second and fourth colors -
and the first and third colors get set to default white and dark gray. If the
image has multiple shades that map to the same index, the palette is instead
determined as if the image had color.
.It
If the image has color (or the grayscale method failed), the colors are sorted
from lightest to darkest.
.El

The input image may not contain more colors than the selected bit depth
allows. Transparent pixels are set to palette index 0.
.Sh ARGUMENTS
.Bl -tag -width Ds
.It Fl D
Debug features are enabled.
.It Fl f
Fix the input PNG file to be a correctly indexed image.
.It Fl F
Same as
.Fl f ,
but additionally, the supplied command line parameters are saved within the PNG
and will be loaded and automatically used next time.
.It Fl d Ar depth
The bit depth of the output image (either 1 or 2).
By default, the bit depth is 2 (two bits per pixel).
.It Fl h
Lay out tiles horizontally rather than vertically.
.It Fl o Ar outfile
The name of the output file.
.It Fl p Ar palfile
Output the image's palette in standard GBC palette format - bytes (8 bytes for
two bits per pixel, 4 bytes for one bit per pixel) containing the RGB15 values
in little-endian byte order. If the palette contains too few colors, the
remaining entries are set to black.
.It Fl P
Same as
.Fl p ,
but the palette file output name is made by taking the input PNG file's
filename, removing the file extension, and appending
.Pa .pal .
.It Fl t Ar mapfile
If any tiles are the same, don't place the repeat tiles in the output file, and
make a tilemap file.
.It Fl T
Same as
.Fl t ,
but the tilemap file output name is made by taking the input filename,
removing the file extension, and appending
.Pa .tilemap .
.It Fl u
Truncate repeated tiles. Useful with tilemaps.
.It Fl V
Print the version of the program and exit.
.It Fl v
Verbose.
Print errors when the command line parameters and the parameters in
the PNG file don't match.
.It Fl x Ar tiles
Trim the end of the output file by this many tiles.
.El
.Sh EXAMPLES
The following will take a PNG file with a bit depth of 1, 2, or 8, and output
planar 2bpp data:
.Pp
.D1 $ rgbgfx -o out.2bpp in.png
.Pp
The following creates a planar 2bpp file with only unique tiles, and its tilemap
.Pa out.tilemap :
.Pp
.D1 $ rgbgfx -T -u -o out.2bpp in.png
.Pp
The following will do nothing:
.Pp
.D1 $ rgbgfx in.png
.Sh SEE ALSO
.Xr rgbds 7 ,
.Xr rgbasm 1 ,
.Xr rgblink 1 ,
.Xr rgbfix 1 ,
.Xr gbz80 7
.Sh HISTORY
.Nm
was created by
.An stag019
to be included in RGBDS.
It is now maintained by a number of contributors at
.Lk https://github.com/rednex/rgbds .