{"id":5246,"date":"2017-05-25T17:21:39","date_gmt":"2017-05-25T14:21:39","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=5246"},"modified":"2017-05-25T17:21:39","modified_gmt":"2017-05-25T14:21:39","slug":"interrupting-ctrl-c-jpegtran-causes-data-loss-when-outfile-points-to-input-file","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2017\/05\/25\/interrupting-ctrl-c-jpegtran-causes-data-loss-when-outfile-points-to-input-file\/","title":{"rendered":"Interrupting (Ctrl-C) jpegtran causes data loss when -outfile points to input file"},"content":{"rendered":"<p>For optimizing files in-place with jpegtran, especially from scripts and when dealing with lots of pictures, it&#8217;s handy to be able to specify input file as -outfile.<\/p>\n<p>But there&#8217;s a catch:<\/p>\n<p>Steps to reproduce:<br \/>\n0. Have a large JPEG file, or, alternatively, somewhat slow CPU<br \/>\n1. `jpegtran -optimize -copy all -perfect -outfile large.jpg large.jpg`<br \/>\n2. Hit Ctrl-C before the command finishes<\/p>\n<p>Result:<br \/>\nYou now have a broken large.jpg with only part, if any, of the image data remaining.<\/p>\n<p>What I expect to happen:<br \/>\nTo have large.jpg as it was before I invoked jpegtran.<\/p>\n<p>Workarounds:<br \/>\nObviously the traditional workaround of specifying an intermediate temporary output file, then replacing the original with the temporary file only once jpegtran has finished.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For optimizing files in-place with jpegtran, it&#8217;s handy to be able to specify input file as -outfile. But there&#8217;s a catch.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[2641],"class_list":["post-5246","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","tag-turvallisuus","sijainti-launchpad"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=5246"}],"version-history":[{"count":1,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5246\/revisions"}],"predecessor-version":[{"id":5247,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5246\/revisions\/5247"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=5246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=5246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=5246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}