Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGBGFX bug #1656

Open
Rangi42 opened this issue Feb 11, 2025 · 3 comments
Open

RGBGFX bug #1656

Rangi42 opened this issue Feb 11, 2025 · 3 comments
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! rgbgfx This affects RGBGFX
Milestone

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Feb 11, 2025

This image of white text on a transparent background (reported in this Discord post):

font_nums.png

With rgbgfx -o font_nums.2bpp font_nums.png, it should be outputting gray text on a white background. Instead, it may output solid white (all $00s), or may just segfault with an assertion failure (assume(index < palette.size()); in TileData::rowBitplanes).

@Rangi42 Rangi42 added bug Unexpected behavior / crashes; to be fixed ASAP! rgbgfx This affects RGBGFX labels Feb 11, 2025
@Rangi42 Rangi42 added this to the 0.9.2 milestone Feb 11, 2025
@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 17, 2025

Note that this bug does not occur with the Rust rewrite; it gives this output (reconverted back to PNG):

font_nums_rust

@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 18, 2025

This is the verbose output:

% ./rgbgfx -vvvvv -o /dev/null font_nums.png
rgbgfx v0.9.1-16-g0150eb4b
Options:
	Bit depth: 2bpp
	Maximum 8 palettes
	Palettes contain 4 colors
	No palette spec
	Input image slice: 0x0 pixels starting at (0, 0)
	Base tile IDs: [0, 0]
	Maximum 65535 tiles in bank 0, 0 in bank 1
	Input image: font_nums.png
	Output tile data: /dev/null
Ready.
Using libpng 1.6.45
Reading tiles...
Opened input file
PNG header signature is OK
Input image: 40x16 pixels, 8bpp RGB + alpha, not interlaced
No embedded palette
Image colors: [ #ffffffff, #00000000, ]
Image contains 1 proto-palette
[ $7fff, ]
Paginating palettes using "overload-and-remove" strategy...
Handling proto-palette 0
Assigning proto-palette 0 to new palette 0
{ [0] 7fff, } (volume = 1)
1 palettes before decanting
1 palettes after decanting on palettes
1 palettes after decanting on "components"
1 palettes after decanting on proto-palettes
{ [0] 7fff, } (volume = 1)
Proto-palette mappings: (1 palette)
0 -> 0
Sorting palette by grayscale bins...
{ 8000, 8000, 8000, }
Generating unoptimized tile data...
Assertion failed: (index < palette.size()), function rowBitplanes, file process.cpp, line 735.

@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 19, 2025

Note, check whether the PNG's alpha indexes are valid within the palette. (See aaaaaa123456789/libplum@67a942f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! rgbgfx This affects RGBGFX
Projects
None yet
Development

No branches or pull requests

1 participant