Full decompression: VIPS Reference Manual

## Full decompression

Many image load libraries do not support random access. In order to use images of this type as inputs to pipelines, libvips has to convert them to a random access format first.

For small images (less than 100mb when decompressed), libvips allocates a large area of memory and decompresses the entire image to that. It then uses that memory buffer of decompressed pixels to feed the pipeline. For large images, libvips decompresses to a temporary file on disc, then loads that temporary file in direct access mode (see above). Note that on open libvips just reads the image header and is quick: the image decompress happens on the first pixel access.

You can control this process with environment variables, command-line flags and API calls as you choose, see `vips_image_new_from_file()`. They let you set the threshold at which libvips switches between memory and disc and where on disc the temporary files are held.

This is the slowest and most memory-hungry way to read files, but it’s unavoidable for many file formats. Unless you can use the next one!