ocrmypdf/OCRmyPDF · error · UnsupportedImageFormatError

Input CMYK image has no ICC profile, not usable

Error message

Input CMYK image has no ICC profile, not usable

What it means

Raised when a CMYK input image lacks an ICC profile. Color conversion from CMYK to RGB cannot be done meaningfully without a color profile, so the file is rejected as unusable.

Source

Thrown at src/ocrmypdf/_pipeline.py:132

                )
        elif not options.image_dpi:
            log.info("Image size: (%d, %d)", *im.size)
            raise DpiError(
                "Input file is an image, but has no resolution (DPI) "
                "in its metadata.  Estimate the resolution at which "
                "image was scanned and specify it using --image-dpi."
            )

        if im.mode in ('RGBA', 'LA'):
            raise UnsupportedImageFormatError(
                "The input image has an alpha channel. Remove the alpha channel first."
            )

        if 'iccprofile' not in im.info:
            if im.mode == 'RGB':
                log.info("Input image has no ICC profile, assuming sRGB")
            elif im.mode == 'CMYK':
                raise UnsupportedImageFormatError(
                    "Input CMYK image has no ICC profile, not usable"
                )

    try:
        log.info("Image seems valid. Try converting to PDF...")
        layout_fun = img2pdf.default_layout_fun
        if options.image_dpi:
            layout_fun = img2pdf.get_fixed_dpi_layout_fun(
                Resolution(options.image_dpi, options.image_dpi)
            )
        with output_file.open('wb') as outf:
            img2pdf.convert(
                os.fspath(input_file),
                layout_fun=layout_fun,
                outputstream=outf,
                **IMG2PDF_KWARGS,
            )
        log.info("Successfully converted to PDF, processing...")

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Convert the image to RGB with a color-managed tool (Photoshop, ImageMagick with a CMYK profile) and retry
  2. Embed an appropriate CMYK ICC profile into the image before running ocrmypdf

Example fix

# before
ocrmypdf press.jpg out.pdf
# after (ImageMagick)
magick press.jpg -profile USWebCoatedSWOP.icc -profile sRGB.icc press_rgb.jpg
ocrmypdf press_rgb.jpg out.pdf
Defensive patterns

Strategy: validation

Validate before calling

from PIL import Image
with Image.open(src) as im:
    if im.mode == 'CMYK' and 'iccprofile' not in im.info:
        im = im.convert('RGB')  # or require profile
        im.save(src)

Prevention

When it happens

Trigger: Input image with im.mode == 'CMYK' and no 'iccprofile' key in im.info; checked in triage_image_file.

Common situations: Print-ready CMYK JPEGs/TIFFs from prepress workflows where the profile was stripped.

Related errors


AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27). Data as JSON: /api/errors/a3e0b34f55a730dc. Report an issue: GitHub.