How to resize png image with alpha canal in boost::gil?
boost::gil::rgb8_image_t image;
boost::gil::rgb8_image_t newSize(640, 480);
boost::gil::png_read_and_convert_image("input.png",image);
boost::gil::resize_view(const_view(image), view(newSize), boost::gil::bilinear_sampler());
boost::gil::png_write_view("output.png",const_view(newSize));
Your problem is not with resizing but with loading the original PNG in the first place, because boost::gil::rgb8_image_t
is an image type without an alpha channel.
The solution is to simply use boost::gil::rgba8_image_t
, which includes an alpha channel.