Skip to the content.

rectarg

Reference and Usage Guide

Version: 1.1
Author: Knut Larsson
Purpose: Generate a calibration target image from ArgyllCMS .cht and .cie pairs, preserving colorimetric values and physical dimensions for printing or soft-proofing.

Example of generated image made with reference data file from LaserSoft Advanced IT8 target (12641-2):

rectarg color target made with reference data file from LaserSoft Advanced IT8 target (12641-2)


Table of Contents

  1. Overview
  2. Supported Targets
  3. Installation
  4. Command-Line Usage
  5. Arguments
  6. Examples
  7. Use Cases
  8. ICC Profile Management
  9. Features
  10. Provided cht Files
  11. Troubleshooting
  12. Technical Reference
  13. Notes

Overview

rectarg.py recreates calibration target images from .cht (chart layout) and .cie (reference data) files compatible with ArgyllCMS. It performs full color conversions (LAB → XYZ (D50) → sRGB (D65 via Bradford)), preserves physical dimensions, and adds fiducials, labels, and geometry for accurate reproduction.

Calibration targets ensure scanners, printers, and displays show colors consistently. Vendors often withhold digital originals; this tool reconstructs them faithfully for visual or colorimetric comparison.

Applications

For example targets, see:

ArgyllCMS is a professional open-source color management system widely used for calibration workflows.


Supported Targets

Tested successfully with .cht and .cie files for:

Notes:

  1. There is a good chance rectarg may be used successfully on other cht-cie file pairs, but ColorChecker Passport is not supported due to unsupported .cht parameters.
  2. In addition to those supplied and tested with rectarg, .cht files for many targets can be found on Argyll’s GitHub Page.

Installation

Dependencies:

pip install numpy Pillow tifffile argparse scipy

Required: numpy, Pillow (PIL), tifffile, argparse Optional: scipy


Command-Line Usage

python3 rectarg.py <chart.cht> <data.cie> <output.tif> [options]

Example

python3 rectarg.py R230122W.cht R230122W.txt output.tif   --target_dpi 300 --background GS10 --intent display --label_axis_visible X=B

Arguments

Type Argument Description
Positional <chart.cht> Chart definition file (ArgyllCMS .cht)
Positional <data.cie> Reference or measurement data (.cie, .txt, or IT8)
Positional <output.tif> Output filename (16-bit TIFF)
Optional --target_dpi [DPI] Output resolution (default: A4-fit scaled to 300 DPI)
Optional --background-color [PATCH_ID] Use specified patch color as background
Optional --intent [absolute;display] Color conversion intent.
absolute : Calibration reference / technical validation Keeps exact colorimetric data. Linear sRGB, 16-bit TIFF. D50→D65 adaptation only (no gamma), no perceptual modification.
display (default): Screen visualization / preview image added gamma 2.2 encoding (nonlinear tone mapping), 16-bit TIFF with gamma.
Optional --color_space [lab;xyz] Input color space (default: lab)
Optional --label_axis_visible [AREA_NAME]=[L;T;R;B;ALL;NONE] Manually toggle label sides. Left, Top, Right, Bottom, ALL (default), NONE. Can be specified multiple times.
Example: --label_axis_visible X=B --label_axis_visible Y=RT Forces only bottom label for area X, as well as right and top labels for area Y.
Optional --margin [MM] Page margin in millimeters (default: 15)
Optional --font [PATH] TrueType font path. If not found, the script searches common system font paths (Palatino, Helvetica, Times, Arial, DejaVuSans)
Optional --font_mm [LABEL_MM] [FOOTER_MM] Physical text heights (default: 2 mm)
Optional --png Save PNG preview
Optional --debug Enable diagnostic output

Examples

For simplicity, open a terminal and go to a folder of choice. Place this script as well as .cht and .cie file in the folder. Run command as shown below.

# Wolf Faust IT8.7/2 target for display
python3 rectarg.py R230122W.cht R230122W.txt output.tif --target_dpi 300 --background GS10 --label_axis_visible X=B

# Wolf Faust IT8.7/2 target with custom font and text size (in mm)
python3 rectarg.py R230122W.cht R230122W.txt output_font.tif --font /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf --font_mm 3.0 2.0

# LaserSoft IT8 target, Absolute Colorimetric
python3 rectarg.py ISO12641_2_1.cht R250715.cie output.tif --intent absolute --background-color N33 --target_dpi 200

# Hutchcolor HCT (XYZ data) for display
python3 rectarg.py Hutchcolor.cht 0579.txt Hutchcolor.tif --target_dpi 200 --color_space xyz

# CMP Digital Target-4 for display
python3 rectarg.py CMP_Digital_Target-4.cht CMP_Digital_Target-4.cie output.tif --target_dpi 200 --color_space xyz --label_axis_visible Y=TLB --label_axis_visible X=TRB --font_mm 1.5 1.5

# LaserSoft DCPro Studio Target for display
python3 rectarg.py LaserSoftDCPro.cht D120104.txt LaserSoftDCPro-200dpi.tif --target_dpi 200 --intent absolute --font_mm 1 1 --margin 7

# QPcard_202 Target, Absolute Colorimetric
python3 rectarg.py QPcard_202.cht QPcard_202.cie output.tif --intent absolute --target_dpi 200 --font_mm 2.5 2.5

# SpyderChecker Target, Absolute Colorimetric
python3 rectarg.py SpyderChecker.cht SpyderChecker.cie SpyderChecker-200dpi.tif --intent absolute --target_dpi 200 --color_space xyz

# SpyderChecker24 for display
python3 rectarg.py SpyderChecker24.cht SpyderChecker24.cie SpyderChecker24-200dpi.tif --target_dpi 200 --color_space xyz

Use Cases

General

Example Use Cases

  1. If you want to produce a printable target that looks like the physical chart (for visual comparison) you can do the following:

    • Option 1: Use rectarg display intent image directly. Print it with color management ON (normal sRGB → printer conversion through your calibrated printer profile). That should yield a print that perceptually matches the physical target, for comparison against original physical reference target.

    • Option 2: Comparison of Printed Image against Soft-Proofing Image Create a soft-proofing image for on-screen comparison against a printed target. Use display-intent image from rectarg and apply a printer’s ICC profile via an application to create the soft-proofing image.

  2. If you want to compare a scanned image of the reference target on-screen against created image from rectarg: Use rectarg display intent image directly. Compare against scanned image on-screen, assuming scanner uses calibrated icc/icm profile. If scanner output is raw, without any profile, then apply a scanner profile onto scanned image before comparing against rectarg display intent image.

  3. If you want to compare a calibrated display against physical reference target: Use the rectarg display intent image directly on the display with color management enabled (ON). Then compare against physical target.

  4. If you want to profile printer: Use rectarg display intent image and print without color management (OFF). Then scan/measure printed image and create icc-profile. If hand scanner is used, scale the image to maximize chart size when printing, if possible.

Overview of Use Cases

Use Case Image Intent Tagged As ICC Conversion Color Management Purpose
Display measurement absolute linear sRGB No ON (monitor ICC) Numeric accuracy
Display visual check display sRGB (γ2.2) No ON Visual comparison
Printer visual comparison display sRGB (γ2.2) Yes
(soft-proofing)
ON Match physical chart visually
Printer profiling display sRGB (γ2.2) OFF Build printer profile
Scanner profiling OFF Build/verify scanner profile
Scanner visual comparison display sRGB (γ2.2) No ON Visual compare scan vs target
Scanner numeric comparison absolute linear sRGB No ON Compare measured Lab vs reference

Intent Notes


ICC Profile Management

Assigning or converting ICC profiles can, for example, be done using:

Example Commands

ImageMagick:

magick rectarg_image_display.tif -profile printer.icc rectarg_image_printproof.tif

ArgyllCMS:

cctiff -i p -v printer.icm rectarg_image_display.tif rectarg_image_printproof.tif

Features


Provided cht Files

Most targets tested with this script were provided with the ArgyllCMS software, and many of those have probably been made manually, as several had odd configurations and dummy data, which caused bad images by rectarg.

For the purpose of generating nice looking images I have edited the definition part of several of the .cht files. Those who want to experiment with getting an exact match of fiducials to original target may modify the .cht file, or use those provided for a nice printout.

Details on how to interpret the specification inside the .cht file are provided below.


Troubleshooting


Technical Reference

Scaling Model

Example:

If 100dpi is detected, scaling factor is calculated in reference to 300 DPI:
  - scale_x ≈ 2.9988 px/unit
  - scale_y ≈ 3.0009 px/unit
  - Each 25.625 unit patch (at 100dpi) becomes ≈ 77×77 px (≈ 6.52 mm per side)

Fiducial Marks

Chart Definition

Example:

D ALL ALL _ _ 613 433 49.0 33.0 0 0

Patch Area Definitions

Example (Wolf Faust Target):

Y 01 22 A L 25.625 25.625 26.625 26.625 25.625 25.625
X GS00 GS23 _ _ 25.625 51.25 1.0 360.5 25.625 0

Interpreted as: [xstart, xend, ystart, yend, tile_x, tile_y, pre_x, pre_y, post_x, post_y]

Color Conversion

Labels and Text

Output

Diagnostics

Normal mode: Summary only. Debug mode: Detailed info on scaling, geometry, patch mapping, and colors.


Notes


End of README