{"record":{"id":"72f7b16a32e0c011","repo":"DrKLO/Telegram","slug":"s-can-only-do-one-image-transformation-at-a-time","errorCode":null,"errorMessage":"%s: can only do one image transformation at a time\n","messagePattern":"(.+?): can only do one image transformation at a time\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/jpegtran.c","lineNumber":118,"sourceCode":"#ifdef C_MULTISCAN_FILES_SUPPORTED\n  fprintf(stderr, \"  -scans FILE    Create multi-scan JPEG per script FILE\\n\");\n#endif\n  exit(EXIT_FAILURE);\n}\n\n\nLOCAL(void)\nselect_transform(JXFORM_CODE transform)\n/* Silly little routine to detect multiple transform options,\n * which we can't handle.\n */\n{\n#if TRANSFORMS_SUPPORTED\n  if (transformoption.transform == JXFORM_NONE ||\n      transformoption.transform == transform) {\n    transformoption.transform = transform;\n  } else {\n    fprintf(stderr, \"%s: can only do one image transformation at a time\\n\",\n            progname);\n    usage();\n  }\n#else\n  fprintf(stderr, \"%s: sorry, image transformation was not compiled\\n\",\n          progname);\n  exit(EXIT_FAILURE);\n#endif\n}\n\n\nLOCAL(int)\nparse_switches(j_compress_ptr cinfo, int argc, char **argv,\n               int last_file_arg_seen, boolean for_real)\n/* Parse optional switches.\n * Returns argv[] index of first file-name argument (== argc if none).\n * Any file names with indexes <= last_file_arg_seen are ignored;\n * they have presumably been processed in a previous iteration.","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/jpegtran.c#L100-L136","documentation":"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).","triggerScenarios":"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.","commonSituations":"Attempting orthogonalize+rotate together, scripting a pipeline that accumulates flags, or misunderstanding that jpegtran requires chaining separate invocations for multiple transforms.","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."],"exampleFix":"// before: two transforms in one call (fails)\n./jpegtran -rotate 90 -flip horizontal in.jpg > out.jpg\n// after: chain two invocations\n./jpegtran -rotate 90 in.jpg | ./jpegtran -flip horizontal > out.jpg","handlingStrategy":"validation","validationCode":"/* in a CLI wrapper, count distinct transform flags before exec */\nconst char *tforms[] = {\"-rotate\",\"-flip\",\"-transpose\",\"-transverse\",\"-trim\",\"-crop\",NULL};\nint count = 0;\nfor (int i=1;i<argc;i++) for (int j=0;tforms[j];j++)\n  if (strncmp(argv[i],tforms[j],strlen(tforms[j]))==0) count++;\nif (count > 1) { fprintf(stderr,\"chain transforms across invocations\\n\"); exit(2); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run one transform per jpegtran invocation, piping between them.","Audit accumulated flag lists in scripted pipelines.","Remember select_transform rejects any second distinct JXFORM_*."],"tags":["jpegtran","transform","cli-args","validation","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}