update resize C++ example

This commit is contained in:
John Cupitt 2019-08-04 17:43:35 +01:00
parent f472df4444
commit 503e83e232

View File

@ -1,12 +1,8 @@
/* /* compile with:
* compile with:
* *
* g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs` * g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs`
*
*/ */
#define DEBUG
#include <vips/vips8> #include <vips/vips8>
using namespace vips; using namespace vips;
@ -14,16 +10,15 @@ using namespace vips;
int int
main( int argc, char **argv ) main( int argc, char **argv )
{ {
if( vips_init( argv[0] ) ) if( VIPS_INIT( argv[0] ) )
vips_error_exit( NULL ); vips_error_exit( NULL );
VImage in = VImage::new_from_file( argv[1], VImage in = VImage::new_from_file( argv[1], VImage::option()
VImage::option()->set( "access", VIPS_ACCESS_SEQUENTIAL ) ); ->set( "access", "sequential" ) );
VInterpolate interp = VInterpolate::new_from_name( "nohalo" );
VImage out; VImage out = in.resize( 0.2, VImage::option()
->set( "kernel", "cubic" )
out = in.resize( 0.2, VImage::option()->set( "interpolate", interp ) ); ->set( "vscale", 0.2 ) );
out.write_to_file( argv[2] ); out.write_to_file( argv[2] );