DrKLO/Telegram · info

%s: no ICC profile data in JPEG file\n

Error message

%s: no ICC profile data in JPEG file\n

What it means

The JPEG contains no usable ICC profile: jpeg_read_icc_profile() returned false and the error code is not JWRN_BOGUS_ICC. Unlike the other djpeg ICC errors this is a plain fprintf (no exit); djpeg continues and still produces image output. It is informational.

Source

Thrown at TMessagesProj/jni/mozjpeg/djpeg.c:795

    JOCTET *icc_profile;
    unsigned int icc_len;

    if ((icc_file = fopen(icc_filename, WRITE_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", progname, icc_filename);
      exit(EXIT_FAILURE);
    }
    if (jpeg_read_icc_profile(&cinfo, &icc_profile, &icc_len)) {
      if (fwrite(icc_profile, icc_len, 1, icc_file) < 1) {
        fprintf(stderr, "%s: can't read ICC profile from %s\n", progname,
                icc_filename);
        free(icc_profile);
        fclose(icc_file);
        exit(EXIT_FAILURE);
      }
      free(icc_profile);
      fclose(icc_file);
    } else if (cinfo.err->msg_code != JWRN_BOGUS_ICC)
      fprintf(stderr, "%s: no ICC profile data in JPEG file\n", progname);
  }

  /* Finish decompression and release memory.
   * I must do it in this order because output module has allocated memory
   * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory.
   */
  (*dest_mgr->finish_output) (&cinfo, dest_mgr);
  (void)jpeg_finish_decompress(&cinfo);
  jpeg_destroy_decompress(&cinfo);

  /* Close files, if we opened them */
  if (input_file != stdin)
    fclose(input_file);
  if (output_file != stdout)
    fclose(output_file);

#ifdef PROGRESS_REPORT
  end_progress_monitor((j_common_ptr)&cinfo);

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Accept that not all JPEGs embed ICC; this message is expected and non-fatal.
  2. If an ICC profile is required, attach one upstream (embed during encoding) or apply a known profile during display.
  3. Filter the message out of automated logs since it is advisory.
  4. Differentiate from JWRN_BOGUS_ICC, which indicates a malformed profile rather than none at all.

Example fix

// before: expecting ICC from a stripped JPEG
./djpeg photo.jpg -icc out.icc > out.ppm
// after: treat absence as normal; check file size
./djpeg photo.jpg -icc out.icc > out.ppm
[ -s out.icc ] || echo "no embedded ICC (expected for sRGB JPEGs)"
Defensive patterns

Strategy: validation

Validate before calling

#include <jpeglib.h>
/* probe before relying on an ICC profile existing */
int has_icc(j_decompress_ptr c) {
  JOCTET *p; unsigned int n;
  int ok = jpeg_read_icc_profile(c, &p, &n);
  if (ok) free(p);
  return ok;
}

Prevention

When it happens

Trigger: Passing -icc <path> on a JPEG that has no APP2 ICC marker at all, or whose marker data does not parse as a valid profile but is not flagged as 'bogus'. The file is created but left empty (note: the fclose for the no-profile branch is not shown here).

Common situations: Decoding sRGB JPEGs without embedded ICC, JPEGs stripped of metadata by an optimizer, or images with only an Exif color space tag instead of an ICC profile.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/35a2db0459b92ce8. Report an issue: GitHub.