2011-11-19 87 views
4

boost::gil读取RGB图像信息是否可能,以便我可以将文件读入正确的rgbx_image_t用gil读取png图像

随着以下我必须事先知道类型,并不那么整洁。

boost::gil::rgb8_image_t im; 
gil::png_read_image(m_filename, im); 

回答

3

你可以让你想尝试和使用any_image持有型擦除结果类型列表:

typedef mpl::vector<rgb8_image_t, rgb16_image_t> my_img_types; 
any_image<my_img_types> runtime_image; 
png_read_image("input.png", runtime_image); 

Source

3

替代引入any_image运行的东西使用* _read_and_convert_image函数族(png_read_and_convert_image为你的情况)