Esempio n. 1
0
/* sizealike by expanding in just one dimension and copying the final element. 
 */
static int
vips__hist_sizealike_vec( VipsImage **in, VipsImage **out, int n )
{
	int i;
	int max_size;

	g_assert( n >= 1 );

	max_size = VIPS_MAX( in[0]->Xsize, in[0]->Ysize );
	for( i = 1; i < n; i++ ) 
		max_size = VIPS_MAX( max_size, 
			VIPS_MAX( in[0]->Xsize, in[0]->Ysize ) );

	for( i = 0; i < n; i++ ) 
		if( in[i]->Ysize == 1 ) {
			if( vips_embed( in[i], &out[i], 0, 0, max_size, 1, 
				"extend", VIPS_EXTEND_COPY,
				NULL ) )
				return( -1 );
		}
		else {
			if( vips_embed( in[i], &out[i], 0, 0, 1, max_size, 
				"extend", VIPS_EXTEND_COPY,
				NULL ) )
				return( -1 );
		}

	return( 0 );
}
Esempio n. 2
0
int
vips__sizealike_vec( VipsImage **in, VipsImage **out, int n )
{
    int i;
    int width_max;
    int height_max;

    g_assert( n >= 1 );

    width_max = in[0]->Xsize;
    height_max = in[0]->Ysize;
    for( i = 1; i < n; i++ ) {
        width_max = VIPS_MAX( width_max, in[i]->Xsize );
        height_max = VIPS_MAX( height_max, in[i]->Ysize );
    }

    for( i = 0; i < n; i++ )
        if( vips_embed( in[i], &out[i],
                        0, 0, width_max, height_max, NULL ) )
            return( -1 );

    return( 0 );
}