Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / gil / doc / html / _downloads / resize.cpp
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #include <boost/gil.hpp>
9 #include <boost/gil/extension/io/jpeg.hpp>
10 #include <boost/gil/extension/numeric/sampler.hpp>
11 #include <boost/gil/extension/numeric/resample.hpp>
12
13 // Example for resize_view() in the numeric extension
14
15 int main()
16 {
17     namespace bg = boost::gil;
18
19     bg::rgb8_image_t img;
20     bg::read_image("test.jpg", img, bg::jpeg_tag{});
21
22     // test resize_view
23     // Scale the image to 100x100 pixels using bilinear resampling
24     bg::rgb8_image_t square100x100(100, 100);
25     bg::resize_view(bg::const_view(img), bg::view(square100x100), bg::bilinear_sampler{});
26     bg::write_view("out-resize.jpg", bg::const_view(square100x100), bg::jpeg_tag{});
27
28     return 0;
29 }