Boost logo

Boost Users :

From: Lloyd (lloydkl.tech_at_[hidden])
Date: 2020-07-23 04:33:38


Hi,

We tried boost gil resize example to experiment with scaling down a jpeg
image file. For some images, this causes the size of the file to increase.
We are using bilinear_sampler algorithm.

Our aim to reduce the input image size so as to save storage/network
bandwidth. Quality can be compromised to a certain extent. Which
algorithm/method should we use?

The code fragment is given below:-

boost::gil::rgb8_image_t img;
boost::gil::read_and_convert_image(InStream, img, T());
float width = (float)(img.width() * Ratio) / 100;
float height = (float)(img.height() * Ratio) / 100;
boost::gil::rgb8_image_t resizedImg(width, height);
boost::gil::resize_view(const_view(img), view(resizedImg),
boost::gil::bilinear_sampler());
boost::gil::write_view(OutStream, boost::gil::const_view(resizedImg), T());

Thanks,
   Lloyd



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net