1. Products
  2.   Image
  3.   C++
  4.   libvips
 
  

Open Source Faster Image Processing Library for  C++

Create, Manipulate, Draw, Divide, Copy & Convert Popular Image Formats; Apply filters, divide two images, grid an image via Free C++ Library.

The libvips is an open source advanced image processing library that uses very low memory and performs very speedy operations. The library can easily handle large images and supports a decent range of image file formats, such as JPEG, TIFF, PNG, WebP, HEIC, FITS, Matlab, OpenEXR, PDF, SVG, HDR, PPM / PGM / PFM, CSV, GIF, Analyze, NIfTI, DeepZoom, and OpenSlide. It can easily load images via ImageMagick or GraphicsMagick, allowing it to work with formats like DICOM.

The libvips primitives are applied sensibly and some use techniques like run-time code generation helps speedy processing of images. In comparison to other image processing libraries, it was noted that libvips need little RAM and run faster, especially on machines with multiple CPUs. This is mainly because of the intelligent architecture it uses which automatically divides the image workflows.

The library provides support for a huge range of numeric types, from simple 8-bit int to the complex 128-bit. Most of the image processing libraries use threaded operations but libvips on the other hand put the threading into the image IO system and assign a copy of the entire image pipeline to each thread for working on it. This horizontal threading style makes better use of processor caches and reduces locking.

The libvips library is an image processing library that offers better performance than many other libraries. The library has provided support for several important image processing features such as drawing images, dividing two images, drawing a circle on an image, copying an image, painting an image into another image, drawing a line on an image, casting an image, cache an image, add two images, make a gaussian image, read a point from an image, grid an image, save the image to JPEG file and many more.

Previous Next

Getting Started with libvips

Clone the latest sources using the following command.

Install libvips via git command

 git clone git://github.com/libvips/libvips.git 

Building from git needs more packages, you’ll need at least gtk-doc and gobject-introspection.

Install libvips packages via git command

 ./autogen.sh
make
sudo make install 

Faster Images Rendering via C++ API

The libvips library has provided functionality for faster image creation and manipulation on all the leading platforms. Some of the leading image processing libraries like ImageMagick and GD libraries are very powerful and provide advanced features for working with images but need a large amount of memory for processing images. On the other hand, libvips can do virtually the same actives as ImageMagick, but much faster and with a comparatively small memory footprint

Save Image to Other supported Formats

The open source libvips library has provided a set of operations that load and save images in a variety of formats. The library has included built-in support for saving images in popular formats like TIFF, JPEG, PNG, Analyze, PPM, OpenEXR, CSV, Matlab, Radiance, RAW, FITS, WebP, SVG, PDF, GIF, and VIPS. The VipsForeign can be used to load and save images in a variety of formats.

Read and write Images to Memory via C++ API

int 
main( int argc, char **argv )
{
	gchar *buf;
	gsize len;
	int i;

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

        if( argc != 2 ) 
		vips_error_exit( "usage: %s FILENAME", argv[0] ); 

	if( !g_file_get_contents( argv[1], &buf, &len, NULL ) )
		vips_error_exit( NULL );

	for( i = 0; i < 10; i++ ) {
		VipsImage *image;
		void *new_buf;
		size_t new_len;
		printf( "loop %d ...\n", i );

		if( !(image = vips_image_new_from_buffer( buf, len, "", 
			"access", VIPS_ACCESS_SEQUENTIAL,
			NULL )) ) 
			vips_error_exit( NULL );

		if( vips_image_write_to_buffer( image, 
			".jpg", &new_buf, &new_len, 
			"Q", 95,
			NULL ) ) 
			vips_error_exit( NULL );

		g_object_unref( image );
		g_free( new_buf );
	}

	g_free( buf );
	vips_shutdown();
	return( 0 );
}

Faster Image Resizing

The open source libvips library gives software developers the power to resize images on the fly inside their own apps. First, you need to load the image from the images repository by providing an image name and complete address. After that, you can resize it to the specified width and height according to your needs. After that, you can save it the location of your choice with the new size.

Read and write Images to Memory via C++ API

int
vips_resize( VipsImage *in, VipsImage **out, 
	double scale, ... )
{
	va_list ap;
	int result;

	va_start( ap, scale );
	result = vips_call_split( "resize", ap, in, out, scale );
	va_end( ap );

	return( result );
}

Image Filtering via C++ API

Image filtering is a valuable feature that is used in various image processing and computer vision applications across the globe. The libvips library provides complete support for Image filtering via C++ commands. Features like smoothing, sharpening, and edge enhancement are some examples of Image processing operations implemented with filtering. The library also included PNG filters like difference to the left, an average of left and up, adaptive, pick best neighbor predictor automatically, and no filtering. It also includes import filters that can load with libMagick and with OpenSlide.

 English