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

Is this library could decode png to bmp? #1

Closed
cyang812 opened this issue Apr 10, 2018 · 4 comments
Closed

Is this library could decode png to bmp? #1

cyang812 opened this issue Apr 10, 2018 · 4 comments
Labels

Comments

@cyang812
Copy link

I know ok_png_read() can get png info, but how can I get bitmap data and write it to a file?

@cyang812
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

Never mind, I get it.
Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants