/* Auto-rotate, if rotate_image is set. */ static VipsImage * read_jpeg_rotate( VipsObject *process, VipsImage *im ) { VipsImage **t = (VipsImage **) vips_object_local_array( process, 2 ); VipsAngle angle = vips_autorot_get_angle( im ); if( angle != VIPS_ANGLE_D0 ) { /* Need to copy to memory or disc, we have to stay seq. */ const guint64 image_size = VIPS_IMAGE_SIZEOF_IMAGE( im ); const guint64 disc_threshold = vips_get_disc_threshold(); if( image_size > disc_threshold ) t[0] = vips_image_new_temp_file( "%s.v" ); else t[0] = vips_image_new_memory(); if( vips_image_write( im, t[0] ) || vips_rot( t[0], &t[1], angle, NULL ) ) return( NULL ); im = t[1]; (void) vips_image_remove( im, ORIENTATION ); } return( im ); }
/* Auto-rotate, if rotate_image is set. */ static VipsImage * thumbnail_rotate( VipsObject *process, VipsImage *im ) { VipsImage **t = (VipsImage **) vips_object_local_array( process, 1 ); if( rotate_image ) { if( vips_rot( im, &t[0], get_angle( im ), NULL ) ) return( NULL ); im = t[0]; (void) vips_image_remove( im, ORIENTATION ); } return( im ); }
/* Auto-rotate, if rotate_image is set. */ static VipsImage * thumbnail_rotate( VipsObject *process, VipsImage *im ) { VipsImage **t = (VipsImage **) vips_object_local_array( process, 2 ); VipsAngle angle = vips_autorot_get_angle( im ); if( rotate_image && angle != VIPS_ANGLE_D0 ) { vips_info( "vipsthumbnail", "rotating by %s", vips_enum_nick( VIPS_TYPE_ANGLE, angle ) ); /* Need to copy to memory, we have to stay seq. */ t[0] = vips_image_new_memory(); if( vips_image_write( im, t[0] ) || vips_rot( t[0], &t[1], angle, NULL ) ) return( NULL ); im = t[1]; vips_autorot_remove_angle( im ); } return( im ); }