---
name: "im_LabS2Lab"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_Lab2LabQ"
---

# im\_LabS2Lab(3)

pack and unpack LABPACK images.

Part of [im\_Lab2LabQ(3)](/im_Lab2LabQ/3.md).

## NAME

im\_LabQ2Lab, im\_Lab2LabQ, im\_LabQ2LabS, im\_LabS2LabQ, im\_Lab2LabS, im\_LabS2Lab - pack and unpack LABPACK images.

## SYNOPSIS

\#include \<vips/vips.h\>

int im\_LabQ2Lab(in, out)\
 IMAGE \*in, \*out;

int im\_Lab2LabQ(in, out)\
 IMAGE \*in, \*out;

int im\_Lab2LabS(in, out)\
 IMAGE \*in, \*out;

int im\_LabS2LabQ(in, out)\
 IMAGE \*in, \*out;

int im\_LabS2Lab(in, out)\
 IMAGE \*in, \*out;

int im\_LabQ2LabS(in, out)\
 IMAGE \*in, \*out;

## DESCRIPTION

These functions pack and unpack LAB images.

LabQ is Lab packed in to 4 unsigned chars, with the Coding field set to LABPACK.  It counts as a coded type, since most operations will not give the correct result on an image of this type.  This is the MARC image type. Bits are allocated as 10 for L and 11 for each of a and b. The first three bytes contain the 8 most significant bits of Lab respectively, the final byte has 2/3/3 bits (MSB on left) of Lab respectively.

im\_LabQ2Lab() and im\_Lab2LabQ() convert LABPACK images to three band float images, scaled to look sensible to humans. This is the most convenient LAB format for development work, but is rather slow.

im\_LabQ2LabS() and im\_LabS2LabQ() convert LABPACK to and from three band signed short images. L is shifted and masked to be in the range \[0,32767\], a and b are shifted and masked to lie in \[-32768,32767\]. This is the best computational LAB format, combining precision and speed. Programs such as conv(1X) and similarity(1X), which can operate directly on LABPACK images, unpack to LabS for computation.

## RETURN VALUE

The functions return 0 on success and -1 on error.

## SEE ALSO

[im\_col\_XYZ2rgb(3)](/im_col_XYZ2rgb/3.md), [im\_dE\_fromdisp(3)](/im_dE_fromdisp/3.md), [im\_XYZ2disp(3)](/im_XYZ2disp/3.md).

## COPYRIGHT

National Gallery, 1990 - 1993

## AUTHOR

J. Cupitt - 21/7/93
