Overview

MuPDF can optionally make use of a color management engine to offer a fully color managed workflow.

Its use of the engine is encapsulated within the fz_cmm_engine structure. Currently we provide an implementation of this structure using a modified version of LCMS2 (known as LCMS2MT), but systems with other CMM engines in already can use those instead by reimplementing the functions therein.

By default, on start-up, MuPDF has no color management engine enabled. This keeps the library size down (and performance up!) for people who do not wish to use it.

The relevant functions are:


\begin{lstlisting}
/*
fz_set_cmm_engine: Set the color management engine to
be...
...to a single thread.
*/
extern fz_cmm_engine fz_cmm_engine_lcms;
\end{lstlisting}

Thus to enable the color managed workflow using LCMS, call:


\begin{lstlisting}
fz_set_cmm_engine(ctx, &fz_cmm_engine_lcms);
\end{lstlisting}

It is best to do this immediately after creating the base context.

It is possible to switch between ICC and non-ICC workflows in the same instance of MuPDF (and even to use the two simultaneously). It is, however, not generally possible to swap a given context once operations on that context have started. This is because any outstanding fz_colorspaces (such as those found within the store) will still refer to the wrong color management implementation!