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

Trying to encode 16 bit RGB PNG but result is 8 bit #56

Closed
dk-teknologisk-mlnn opened this issue Jul 13, 2017 · 2 comments
Closed

Trying to encode 16 bit RGB PNG but result is 8 bit #56

dk-teknologisk-mlnn opened this issue Jul 13, 2017 · 2 comments

Comments

@dk-teknologisk-mlnn
Copy link

dk-teknologisk-mlnn commented Jul 13, 2017

Hi,

I cannot get it to work with saving a 16 bit RGB image. I end up with 8 bit RGB. Upon decoding the file again it gives me state.raw_info.bitdepth == 8 .
I tried with : lodepng::encode(pstr, VImage, m_x, m_y, LCT_RGB, 16U);
and also using state:
lodepng::State state;
state.info_raw.bitdepth = 16U;
state.info_raw.colortype = LCT_RGB;
state.encoder.auto_convert = 1;
state.info_png.color.bitdepth = 16;
state.info_png.color.colortype = LCT_RGB;

			std::vector<unsigned char> png;
			
			unsigned error = lodepng::encode(png, Vimage, m_x, m_y, state);
		
			if (!error) lodepng::save_file(png, pstr);
@dk-teknologisk-mlnn
Copy link
Author

it is working now with "state". It was "autoconvert" that switched it back to 8bit.

@lvandeve
Copy link
Owner

Indeed, by default it converts to the smallest color model possible, but this can be disabled with the state, thank you for figuring it out :)

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

No branches or pull requests

2 participants