DrKLO/Telegram · error
%s: can only do one image transformation at a time
Error message
%s: can only do one image transformation at a time
What it means
jpegtran's select_transform() detected that a second, different image transform was requested when one is already set (transformoption.transform != JXFORM_NONE and != the new transform). Only one spatial transform (rotate/flip/transpose/crop/etc.) is allowed per invocation. It prints the message and calls usage() (which exits).
Source
Thrown at TMessagesProj/jni/mozjpeg/jpegtran.c:118
#ifdef C_MULTISCAN_FILES_SUPPORTED
fprintf(stderr, " -scans FILE Create multi-scan JPEG per script FILE\n");
#endif
exit(EXIT_FAILURE);
}
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.View on GitHub (pinned to 45ab8f4308)
Solutions
- Run jpegtran once per transform, piping output to the next: jpegtran -rotate 90 in.jpg | jpegtran -flip horizontal > out.jpg.
- Remove all but one transform flag from the current command.
- For combinations that are expressible as a single transform, use that instead (e.g. transpose instead of rotate+flip).
- Review select_transform usage to confirm only one JXFORM_* is selected.
Example fix
// before: two transforms in one call (fails) ./jpegtran -rotate 90 -flip horizontal in.jpg > out.jpg // after: chain two invocations ./jpegtran -rotate 90 in.jpg | ./jpegtran -flip horizontal > out.jpg
Defensive patterns
Strategy: validation
Validate before calling
/* in a CLI wrapper, count distinct transform flags before exec */
const char *tforms[] = {"-rotate","-flip","-transpose","-transverse","-trim","-crop",NULL};
int count = 0;
for (int i=1;i<argc;i++) for (int j=0;tforms[j];j++)
if (strncmp(argv[i],tforms[j],strlen(tforms[j]))==0) count++;
if (count > 1) { fprintf(stderr,"chain transforms across invocations\n"); exit(2); } Prevention
- Run one transform per jpegtran invocation, piping between them.
- Audit accumulated flag lists in scripted pipelines.
- Remember select_transform rejects any second distinct JXFORM_*.
When it happens
Trigger: Combining flags like -rotate 90 with -flip horizontal, or -transpose with -rotate, in a single jpegtran command. Each transform flag routes through select_transform, which rejects a second distinct transform.
Common situations: Attempting orthogonalize+rotate together, scripting a pipeline that accumulates flags, or misunderstanding that jpegtran requires chaining separate invocations for multiple transforms.
Related errors
- %s: must name one input and one output file
- %s: sorry, image transformation was not compiled
- %s: bogus -crop argument '%s'
- %s: skip region exceeds image height %d\n
- %s: crop dimensions exceed image dimensions %d x %d\n
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/72f7b16a32e0c011.
Report an issue: GitHub.