A SERVICE OF

logo

66 Chapter 3
convert()
Converts the image to the specified type/bit-depth. The 8-bit type is not supported, since
this involves a much more complex transformation (palette selection, etc.) — instead, use
reduce().
When converting images with no alpha channel, the generated alpha channel is based on
the background color of the original if the background is set to transparent. Otherwise, the
resulting alpha channel is solid white. You can also use the setColor() function (placed
before the convert() function in the MediaScript) to set the background color, with
Transparency set to true.)
NOTE: convert() will convert between CMYK and CMYKA. To convert CMYK color-space to
RGB color-space and vice versa use colorCorrect().
Syntax
convert(
RType @ <"bit-depth">
[Dither @ <value 0..10>]
[PreserveBackground @ <true, false>]
[layers @ <"layer list">] // (PSD files only)
);
Parameters
Rtype - specifies the target bit depth. Supported bit-depths are: “Gray-8”, “RGB-15”,
“RGB-16”, “RGBA-16”, “RGB-18”, “RGB-24”, “RGBA-32”, “HSV-24”, “HLS-24”, “CMYK-
32”, and “CMYKA-40”. The 16-bit type is 5-6-5, while the 16a-bit is 1-5-5-5 with the top bit
as an alpha channel.
In addition, the following shortcuts will have default values when used as input
parameters:
Gray -> Gray-8
RGB -> RGB-24
RGBA -> RGBA-32
HSV -> HSV-24
HLS -> HLS-24
CMYK -> CMYK-32
CMYKA -> CMYKA-40
NOTE: Deprecated parameters include: “Grayscale”, “15-bit”, “16-bit”, “16a-bit”, “24-bit”,
“32-bit”.
Dither - determines the level of dithering to use for remapping image pixels to a lower
bit-depth.
PreserveBackground - when dithering is used, eliminates any pixels in the source
image that match the background color from the dithering process in the destination
image. This can be used to eliminate fuzzy edges for an object against a solid color
background.