This class represents references to media content (such as images)
located within Commerce Cloud Digital or on external systems.
Some methods allow the specification of image transformation parameters. Image
transformation is only performed if the Dynamic Imaging Service (DIS) is available
for the Commerce Cloud Digital instance, otherwise a standard static content URL
is returned. The to-be-transformed image needs to be hosted on Commerce Cloud
are translated into URL parameters. See
|Type of transformation
|Scale an image
are both integers; setting one of these parameters triggers a
scaling operation. If both are provided, the one that scales the
image less is used to calculate the scale factor. The image is then
automatically cropped accord to the second dimension, with a
centered position of the cropped area. If the parameter would scale
the image larger, only this operation is applied, if the image
remains within acceptable pixel dimensions.
scaleMode can only be used in combination with
scaleMode parameter can be set to
fit. The default
cut, the behavior of which is explained above. If you
fit as the
scaleMode, the system
scales the image into the given box of dimensions while keeping the
aspect ratio (possibly resulting in a smaller image in one
|Overlay an image
imageY parameters are both
integers. Valid values for these parameters are 0 or greater.
Supported formats are
imageURI parameter can be set to the absolute path
of the overlaid image. The value of the
parameter must be given in proper URL encoding, and it cannot exceed
400 characters in length. The path may include query string
parameters, which supports dynamically generating the overlaid image
itself through this service; that is, the overlaid image can itself
be a transformed image.
If the overlaid image extends over the primary image's boundaries,
the overlaid image is cropped so that it fits directly over the
|Crop an image
cropHeight parameters are integers. All four parameters
must be specified to trigger a cropping operation.
Valid values for the
parameters are 0 or greater. If the crop location defined by
cropY is outside the image area,
nothing is cropped.
Valid values for the
cropHeight parameters are 10 or greater. If the
specify a size that is greater than the original image, the crop
area is reduced to the actual image area. If
cropHeight are 0 or less, no transformation is
|Format an image
format parameter specifies the target format of
image. Supported formats are
gif. If no target format is specified, no format
conversion is performed.
The attribute value must reference the source image. Source image's
format is recognized by the file extension which must be
In the generated URL the file extension of the target format is used
in the URL path. This is to make sure the image is loaded from an
URL with a matching file extension. The source format is provided as
|Adjust image compression quality
quality parameter specifies a quality setting for
and specifies the compression level for
jp2 images, you can set values from 1–100 for the highest quality.
The default quality is 80. If you're not changing the default quality, you don't need to pass in a value.
png images, the quality setting has no effect on the appearance of the
png, since the compression is always lossless.
Instead you can use the quality setting to set the zlib compression level and filter-type for PNG images.
The tens digit sets the zlib compression level(1-9). The ones digit sets the filter type.
png setting is not present or set to 0, it uses a default value of 75.
If this setting is set to 100, it actually equals the quality setting 90.
|Adjust Metadata stripping
strip parameter specifies if metadata like EXIF and color profiles is
stripped from the image during transformation.
Valid values for the
strip parameter are between
The default is
|Change background color
bgcolor(color) or bgcolor(color+alpha)
bgcolor parameter specifies the background color for images that support transparency
as well as JPEG images when being converted from a format that supports transparency.
Optionally, alpha setting for PNG images are also supported.
bgcolor expects a 6 digit hexadecimal value of RGB with an optional
two hexadecimal characters representing alpha value that determines transparency.
FF0000 = Red
FF000077 = Red with 50% transparency
Alpha values are optional. When the alpha value is omitted, the resulting color is opaque.
Alpha values are only valid when the image output format is PNG.