How to apply DCP custom profile on TIFF or JPG or other non-DNG format?

For processing raw images from a technical non-commercial camera I like to apply an existing external DCP profile including its tone response curve to a TIFF/JPG/PNG (or other non-DNG) image.

However, when selecting the DCP custom profile, it isn’t applied. I tried the same with an ICC profile, which changes the display slightly, but in a different way than on comparable DNG raw images.

How could this functionality be achieved with the current RT version? Maybe converting my TIFF/PNG/JPG to some other simple raw format? Converting to DNG doesn’t appear to be possible, at least I couldn’t find a free software yet.

The RawTherapee documentation gives a concise but useful description of digital camera profiles. From RawPedia:

Technically, each photosite in a digital photography camera’s image sensor outputs a certain current based on the number of photons of light that hit that photosite. The current is converted into a number. These numbers, along with some metadata, are stored in what is known as a “raw file”. At this point there is no concept of color and the raw data looks nothing like an image. As in traditional photography, the image must be “developed” into a usable form. One of the steps of this development involves translating the numbers into accurate colors, and for that you need to profile the camera, to map the numbers to specific known colors.

Practically, you must use an input color profile in order to get accurate colors, and currently the best way to go about this is using a “DNG camera profile” (DCP for short - do not confuse with the entirely unrelated Digital Cinema Package). The input color profile is what makes a camera’s colors look they way they do when you open a photo, before you make any tweaks.

or from xrite

A digital camera profile describes the conversion of the digital camera specific RGB space to the CIE Lab system. The test chart determines which colors from the original will be converted to which RGB colors of the digital camera. However, since a test chart only covers part of the digital camera’s entire gamut, it is the profiling software’s job to supply a description of those colors that are in the outer areas of the device gamut.

In italic , wrong and misleading terms used by xrite. Raw files don’t contain colors neither RGB data.

As TIFF/JPG/PNG are already developed images coded in some color space (sRGB…), DCP cannot be applied to them.

I don’t know if it is possible to apply an ICC profile for artistic purpose in RT. The best is to read rawpedia

It’s definitely possible. A DNG is just a TIFF file with specific metadata and renamed DNG. The metadata can be added with exiftool, Loading .raw images (from industrial cameras) - #7 by Entropy512 has an example of doing it for bayer data.

Non-bayer DNGs are also possible, it’s often referred to as “linear DNG”, although DNG also supports nonlinear encoding too. SamplesPerPixel will change as will PhotometricInterpretation. I’ve worked with non-bayer “linear DNGs” before but never synthesized one.

1 Like

Many thanks, that link will help! That’s exactly my use case as I have images from custom cameras which only produce bitmaps not in one of the commercial camera’s raw format. Applying ICC profiles does already work with imagemagick convert -profile, but not for DCP which is why I was looking for trying RT. Also mostly only simple ICC profiles, i.e. only the matrix, are understood by most image display tools.

As soon I get something running in a few days I’ll add reply here.

Technically, the image data in DNG files or TIFF or others is just an array of numbers and calculations based on the DCP matrix, shaper curves and other attributes are applied by RT or other software. The reason why I prefer to use RT or similar software instead of doing the calculations in some python or other code is to avoid errors as there are so many pitfalls and small issues you can run into during high quality image processing which are already considered by software like RT.

I am curious, what DCP functions are you using that aren’t available in an ICC profile? HueSatMap corrections?

While you can in theory create a linear DNG, I’ve found that attaching an appropriate ICC profile to JPEG or TIFF images in nonstandard colorspaces/using nonstandard transfer functions is a little easier and more compatible with a wider variety of software. I use that to load Sony S-Log3+S-Gamut3 images into RT - https://github.com/Entropy512/elles_icc_profiles/tree/log_profiles

That was some months ago when I tried applying ICC profiles to TIF, PNG and JPG where the ICC file was generated with argyllcms and dcamprof. I tried various types of ICC files (CLUT, matrix, matrix+shaper curves) and only very simple ones with just a matrix produces somewhat consistent results, but not really usable results.

In addition with ICC the problem exists that graphic display tools are not really made for interpreting custom ICC files and all are producing slightly different results. Most likely real ICC handling is only implemented in OS graphics drivers.

With DCP I expect more consistent results as I can produce a PNG with embedded standard sRGB color profile in them and all the DCP handling is done by RawTherapee while creating the PNG.

My first tries a few minutes ago with your suggested exiftool approach were successful: I can load my images now and can apply a DCP profile even including shaper curves. I generated a bayered gray image to do that. As soon I have my use case solved in some days I’ll reply and maybe it can be even made into a blog article.

And back then during working with ICC I used other tools than RawTherapee. I’ll also do experiments with ICC again on RT…