For optimizing files in-place with jpegtran, especially from scripts and when dealing with lots of pictures, it’s handy to be able to specify input file as -outfile.
But there’s a catch:
Steps to reproduce:
0. Have a large JPEG file, or, alternatively, somewhat slow CPU
1. `jpegtran -optimize -copy all -perfect -outfile large.jpg large.jpg`
2. Hit Ctrl-C before the command finishes
You now have a broken large.jpg with only part, if any, of the image data remaining.
What I expect to happen:
To have large.jpg as it was before I invoked jpegtran.
Obviously the traditional workaround of specifying an intermediate temporary output file, then replacing the original with the temporary file only once jpegtran has finished.