DrKLO/Telegram · error

%s: sorry, image transformation was not compiled

Error message

%s: sorry, image transformation was not compiled

What it means

A transform option (e.g. -rotate, -flip, -crop, -transpose) was passed to jpegtran, but the build was compiled without TRANSFORMS_SUPPORTED. The program prints this message and exits with failure; no transformation is possible.

Source

Thrown at TMessagesProj/jni/mozjpeg/jpegtran.c:123


LOCAL(void)
select_transform(JXFORM_CODE transform)
/* Silly little routine to detect multiple transform options,
 * which we can't handle.
 */
{
#if TRANSFORMS_SUPPORTED
  if (transformoption.transform == JXFORM_NONE ||
      transformoption.transform == transform) {
    transformoption.transform = transform;
  } else {
    fprintf(stderr, "%s: can only do one image transformation at a time\n",
            progname);
    usage();
  }
#else
  fprintf(stderr, "%s: sorry, image transformation was not compiled\n",
          progname);
  exit(EXIT_FAILURE);
#endif
}


LOCAL(int)
parse_switches(j_compress_ptr cinfo, int argc, char **argv,
               int last_file_arg_seen, boolean for_real)
/* Parse optional switches.
 * Returns argv[] index of first file-name argument (== argc if none).
 * Any file names with indexes <= last_file_arg_seen are ignored;
 * they have presumably been processed in a previous iteration.
 * (Pass 0 for last_file_arg_seen on the first or only iteration.)
 * for_real is FALSE on the first (dummy) pass; we may skip any expensive
 * processing.
 */
{

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Rebuild libjpeg-turbo/mozjpeg with -DTRANSFORMS_SUPPORTED=1 (default on for full builds; ensure transupp.c is compiled in).
  2. Use a prebuilt full distribution that includes transformation support.
  3. If transforms cannot be enabled, decode with djpeg, transform in another tool, and re-encode with cjpeg.
  4. Check the build's CMake/Make config for any flag that stripped transupp.c.

Example fix

# before: minimal build, transform disabled
./jpegtran -rotate 90 in.jpg > out.jpg
# after: rebuild with transforms enabled
cmake -DWITH_SIMD=1 ... && make   # TRANSFORMS_SUPPORTED is default-on
./jpegtran -rotate 90 in.jpg > out.jpg
Defensive patterns

Strategy: type-guard

Type guard

#if defined(__has_include)
  #include <jmorecfg.h>
#endif
/* build-time check */
#ifndef TRANSFORMS_SUPPORTED
#error "this jpegtran cannot do transforms; rebuild with TRANSFORMS_SUPPORTED"
#endif

Prevention

When it happens

Trigger: Using a minimal/stripped libjpeg build where the transformation code paths were excluded at compile time via the feature macro. Any -rotate/-flip/-transpose/-transverse/-trim/-crop invocation hits the #else branch.

Common situations: Distributing a trimmed mozjpeg/libjpeg-turbo build for size (e.g. decode-only on mobile), or building from a configuration that disabled the transtransform sources. The error is consistent for every transform flag until rebuilt.

Related errors


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