Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux batch conversion: Change quality of jpg with convert but keep its name

If I convert my images with

convert -quality 80% *.jpg 

It works, but the software changes the file names to the first one it picks. How can I keep the name or even replace the previous image with that of a lower quality.

like image 448
Frank Vilea Avatar asked Mar 29 '12 16:03

Frank Vilea


2 Answers

Try this instead:

mogrify -quality 80% *.jpg 
like image 50
Zsolt Botykai Avatar answered Sep 19 '22 05:09

Zsolt Botykai


convert command help:

convert input-file [options] output-file

Now a little script to convert all jpg files to 80% quality of original under current directory

for file in *.jpg; do   convert "$file" -quality 80% "$file" done; 
like image 41
ring bearer Avatar answered Sep 19 '22 05:09

ring bearer