# CompressedFormat

Available since LÖVE 0.9.0
This enum is not supported in earlier versions.

Compressed image data formats. Here and here are a couple overviews of many of the formats.

Unlike traditional PNG or jpeg, these formats stay compressed in RAM and in the graphics card's VRAM. This is good for saving memory space as well as improving performance, since the graphics card will be able to keep more of the image's pixels in its fast-access cache when drawing it.

## Constants

dxt1
  The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images.
dxt3
  The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
dxt5
  The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity.
bc4
  The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
bc4s
  The signed variant of the BC4 format. Same as above but the pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.
bc5
  The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
bc5s
  The signed variant of the BC5 format.

Available since LÖVE 0.9.2
These constants are not supported in earlier versions.

bc6h
  The BC6H format. Stores half-precision floating-point RGB data in the range of [0, infinity) at 8 bits per pixel. Suitable for HDR images.
bc6hs
  The signed variant of the BC6H format. Stores RGB data in the range of (-infinity, +infinity.)
bc7
  The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.
bc7srgb
  The sRGB-encoded variant of the BC7 format.

## Notes

Not all formats are supported in love.graphics Images on all systems, although the DXT formats have close to 100% support.

The BC4 and BC5 formats are supported on systems with DirectX 10 / OpenGL 3-capable hardware and drivers. The BC6H and BC7 formats are only supported on systems with DirectX 11 / OpenGL 4-capable hardware and very recent drivers. Mac OS X does not support BC6H or BC7 at all yet.

Use love.graphics.getCompressedImageFormats to check for support:

    local supportedformats = love.graphics.getCompressedImageFormats()

    if not supportedformats["dxt5"] then
        -- Can't load CompressedData with the DXT5 format into images!
        -- On some Linux systems with Mesa drivers, the user will need to install a "libtxc-dxtn" package because the DXT (aka S3TC) formats are patented.
        -- Support for DXT formats on all other desktop drivers is pretty much guaranteed.
    end

    if not supportedformats["bc5"] then
        -- Can't load CompressedData with the BC5 format into images!
        -- The user likely doesn't have a video card capable of using that format.
    end

## See Also

- love.image
- CompressedData
- CompressedData:getFormat
- love.graphics.getCompressedImageFormats

##

Category:

- Enums