Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jpegtran optimize without changing filename

Tags:

I need to optimize some images, but not change their name.

jpegtran -copy none -optimize image.jpg > image.jpg  

However, this seems to create an filesize of 0. When i do it to a different filename, the size is still exactly the same.

like image 290
David Avatar asked Apr 07 '11 09:04

David


1 Answers

how about:

jpegtran -copy none -optimize -outfile image.jpg image.jpg 

I'm not a shell expert by any means, but I think that with your original command, as soon as it is executed, the redirect is set up which overwrites your image.jpg. Then when jpegtran tries to read it in it finds an empty file.

like image 132
so12311 Avatar answered Oct 04 '22 09:10

so12311