One of the issues that I ran into early while testing Cruncher was the need to run custom ICC profile conversions. This is not as common of a requirement as some others, but it is beneficial to document this aspect of the application.

How ICC profile conversion works

ICC Profile conversion is done by specifying an input ICC profile and both an output ICC profile and color output format.

By default, Cruncher checks each JPEG to see if it has an ICC profile embedded in the image. If it does, Cruncher will use that ICC profile for any color manipulation. However, JEPGs can be created with an ICC profile that is not embedded in the image. If that is the case, it is up to each JPEG decoder to provide an ICC profile. This does not always produce great results.

How to configure ICC profile conversion

The configuration is pretty straight forward. You will need to create an icc_conversions object in your JSON config file.

Each icc_conversion conversion profile is identified by its name. In this example, the name is adobe. To apply this conversion to a version you set the version icc_conversion to the name of the icc_conversions profile you want to use.

{
    "directory": "C:\\Path to images\\backgrounds",
    "output": "C:\\Path to images\\backgrounds\\crunched",
    "recursive": true,
    "icc_conversions": {
        "adobe": {
            "input_icc": "C:\\Windows\\System32\\spool\\drivers\\color\\USWebCoatedSWOP.icc",
            "output_icc": "C:\\Windows\\System32\\spool\\drivers\\color\\sRGB Color Space Profile.icm",
            "mode": "RGB"
        }
    },
    "versions": [
        {
            "comment": "Background image compression for web page with custom ICC profile conversion",
            "file_format": "JPEG",
            "quality": 70,
            "width": 1920,
            "height": 1080,
            "append": "-bg",
            "keep_metadata": false,
            "icc_conversion": "adobe"
        }
    ]
}

You can create multiple ICC conversions in a single config file.

each icc_conversions object has three attributes:

input_icc This is the path to the input ICC profile.

output_icc This is the path to the output ICC profile.

mode This is the color format of the output ICC profile.

Note: ICC conversions greatly increase the computation required to compress images. Only use an ICC profile conversion if you need to do so to retain proper image chrominance.