Итак, я сделал тестовое индексированное изображение в GIMP и несколько часов безуспешно пытался преобразовать его в 8-битный RGBA. Вот код:
Код: Выделить всё
#include
#include
#include
int main(int argc, char** argv) {
// reading
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
png_infop info = png_create_info_struct(png);
std::FILE* fp = std::fopen("paletted.png", "rb");
png_init_io(png, fp);
png_read_info(png, info);
png_uint_32 width, height;
int depth, color;
png_get_IHDR(png, info, &width, &height, &depth, &color, nullptr, nullptr, nullptr);
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79334694/how-to-convert-indexed-8-bit-png-image-to-8-bit-rgba-with-libpng[/url]