Libvips: Tiled Multi-Resolution TIFF

Created on 15 Oct 2019  路  2Comments  路  Source: libvips/libvips

the way convert jpg file to Tiled Multi-Resolution TIFF like this,

    VipsImage *in;
    const char * srcfile = "testimg.jpg";
    if (!(in = vips_image_new_from_file(srcfile, NULL))){
        printf("\n");
    }
    im_vips2tiff(in, "res.tiff");

can only get one level tiff ,what is the right way?

question

All 2 comments

Hello @xiangbeihai521,

You need to enable pyramid write. Try:

/* compile with
 *
 *      gcc -g -Wall pyrwrite.c `pkg-config vips --cflags --libs`
 */

#include <vips/vips.h>

int
main( int argc, char **argv )
{
        VipsImage *im;

        if( VIPS_INIT( argv[0] ) )
                vips_error_exit( NULL );

        if( !(im = vips_image_new_from_file( argv[1],
                "access", VIPS_ACCESS_SEQUENTIAL, 
                NULL )) )
                vips_error_exit( NULL ); 
        if( vips_image_write_to_file( im, argv[2],
                "compression", VIPS_FOREIGN_TIFF_COMPRESSION_JPEG,
                "pyramid", TRUE,
                "tile", TRUE,
                NULL ) )
                vips_error_exit( NULL ); 
        g_object_unref( im );

        return( 0 );
}

thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AKlein920 picture AKlein920  路  3Comments

Boojs picture Boojs  路  5Comments

erdmann picture erdmann  路  4Comments

helloqhx picture helloqhx  路  3Comments

doronAtuar picture doronAtuar  路  4Comments