DC 5.9 Image media formats

General settings

Media formats are as mentioned in the general overview controlled through the DAM Center backend under System tools → Formats.

Editing a media format will give the below details view

At first it may look very confusing, but it is important to understand that the media format definition holds information on many different media types.

Therefore, the most important parameters for Image formats are

  • Format type

  • Settings

The format types defines the resulting end file (e.g. Jpg in the screenshot case) and settings is the ImageMagick command line. It is out of the scope of this documentation to explain all possible flags for ImageMagick. We refer to the official documentation instead.

Settings configuration

Configuring an Image format requires a basic understanding of ImageMagick. We are exposing the tool with a few additions that will be explained in this section

As a reference for this section we refer to the following command line

%infile%[0] -background white -flatten -auto-orient %iccconversion% -interlace Plane -quality 80 -density 72x72 -resize 600x360> %Outfile%

As the quick reader may already have noticed this is very similar to standard ImageMagick with the addition of what is called replace tags.

A replace tag is a tag encapsulated in %% which will be replaced with a corresponding value when actually executing the transcode.

The replace tags in the above command line are

  • %infile%

  • %Outfile%

  • %iccconversion%

The first two tags controls the input file which is the source file of the asset and the output file which is the resulting output file. Lastly there is a special tag called %iccconversion% which is used for color conversion between color spaces and as such will be explain in greater details in that section.

The rest of the command line is a standard ImageMagick commandline.

Resizing

Resizing is the most common use-case for formats and therefore it requires a little explanation. Resizing can be accomplished in many ways through ImageMagick, but the most common case is using the -resize parameter. This parameter takes an Image geometry as input which is explained in greater details on the ImageMagick docuementation

Color conversion

Color conversion can be very tricky when converting from one color space to another.

A color space is a definition of a color model. A computer needs a numerical value that represents a color and the color space defines how the numerical value is represented. For instance the simple example is RGB which stands for Red, Green and Blue. The numerical value is often an 8-bit representation for each value which gives us (0,0,0) where each number represent a nuance of Red, Green and Blue. Because it is an 8-bit representation, each number can have 28 = 256 different values giving us the ability to represent 2563= 16.777.216 different colors.

CMYK as another example is a different way of representing the same thing.

So the color space is the definition of how the colors are represented.

The color space and the color profile is often thought of as the same thing, but they are not! While the color space is the definition of how the numerical value is represented, then the color profile is the actual numerical representation. In other words it defines the numerical value of the color space and what exactly it maps to.

In other words the color space is the definition and the color profile is the implementation.

It is possible to convert between two color spaces by simple algorithms that define how one representation of a color looks in one and the other. Often this translation is done by using a source color profile and a target color profile.

The problem with converting from one to another is that they often are not the same size. In fact the RGB color space is larger than the CMYK color space and for that reason you cannot convert between the two without having some distortion.

This is best represented in the below drawing.

In ImageMagick there are different options for color conversion.

Example 1: RGB to CMYK using color space

The simplest approach is defining the -colorspace property

myRGBinput.jpg -colorspace CMYK myCMYKoutput.jpg

This conversion is rather naive and often gives very distorted images. The reason for that is Imagemagick have no definition of the actual implementation (i.e. color profile) and therefore naively maps between the two color spaces.

Example 2: RGB to CMYK using color profiles

Another approach is to specify the source and the target color profiles.

(First -profile tag defines source, second defines target)

myRGBInput.jpg -profile myRGBprofile.icc -profile myCMYKprofile.icc myCMYKoutput.jpg

This often gives a much better result because Imagemagick uses the two profiles to actually map between the color spaces.

Example 3: RGB to CMYK using an embedded color profile

Imagemagick has a third option as well, where it’ll use the embedded color profile in the image.

This works provided that the input file actually has an embedded color profile that defines the source color space. Not all files has this embedded!

With the above explanation in place the %iccconversion% replace tag can now be explained in greater details.

This tag actually executes a little bit of logic when determining how the color space conversion should be conducted and combines Example 3 and Example 2 in order to convert the colors the best it can.

If the input file has an embedded color profile this is assumed to be correct and hence this is used as source profile. If the input file does not have an embedded color profile the engine fallbacks to a generic color profile matching the input files colorspace.

The target profile is determined the ICC Profile input field on the Media format definition defines.

The Digizuite constant ICC_PROFILE_LOCAL_FOLDER must point to the location on disk where the generic profiles are located.

Therefore it should also be apparent that the safest color space conversion is using the %iccconversion% replace tag and more importantly uploading files with their source ICC Profile embedded in them. If the source color profile is not embedded Digizuite cannot guarantee that the resulting color conversion is not distorted.