C API misreports width of this PNG

LCDBitmap *fadeGradientTransparent = pd->graphics->loadBitmap("images/fade-gradient-transparent", NULL);
int width;
pd->graphics->getBitmapData(fadeGradientTransparent, &width, NULL, NULL, NULL, NULL);
pd->system->logToConsole("%i should be 512", width);

If you build a C project with the above code and include the image below, it will disregard several columns of pixels:


(Note: if you don't see the image above, make sure this web page is displayed with Dark Mode turned off. It's a black image with transparent regions.)

Discovered on a Mac, building with CMake.

The image is 512x20, and the last 20 or so pixels on its end are black and opaque. The C API says it's only 496 pixels wide.

This has been reported been reported before back in March, but it doesn’t look like it been fixed yet. You can have a look at this bug report for an explanation: getBitmapData() incorrect size for transparent bitmaps

1 Like

this is fixed (finally) in 1.12, out soon! :slight_smile: