Is this library could decode png to bmp?
cyang812 opened this issue · 4 comments
cyang812 commented
I know ok_png_read()
can get png info, but how can I get bitmap data and write it to a file?
cyang812 commented
I try to use this sentence to write a file, but output is not correct. I mean output file size is correct, but content is not.
fwrite(image->data, sizeof(uint8_t), image->width * image->height * 4, file)
brackeen commented
Is this library could decode png to bmp?
ok-file-formats
doesn't have an encoders, so if you want to encode to BMP you'll have to use a different library (or write it yourself).
As far as the code sample goes, it looks like you're creating a RAW file.
What do you mean by "output is not correct"?
cyang812 commented
How to check the output RAW file is correct?
I use XnView software to open it, but it doesn't looks like a real image.
cyang812 commented
Never mind, I get it.
Thanks a lot.