File: resize.cpp

package info (click to toggle)
vips 8.18.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 53,240 kB
  • sloc: ansic: 172,611; cpp: 12,257; python: 5,077; sh: 773; perl: 40; makefile: 25; javascript: 6
file content (33 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* compile with:
 *
 *      g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs`
 */

#include <vips/vips8>

using namespace vips;

int
main(int argc, char **argv)
{
	if (VIPS_INIT(argv[0]))
		vips_error_exit(NULL);

	if (argc != 3)
		vips_error_exit("usage: %s infile outfile", argv[0]);

	VImage in = VImage::new_from_file(argv[1],
		VImage::option()
			->set("access", "sequential"));

	VImage out = in.resize(0.2,
		VImage::option()
			->set("kernel", "cubic")
			->set("vscale", 0.2));

	out.write_to_file(argv[2]);

	vips_shutdown();

	return 0;
}