Dhinakar
Dhinakar

Reputation: 4151

reduce image size using imagemagick for batch of images

I need to convert batch of .jpg images filesize using image magick. am able to convert a single file using the following code

  convert -strip -interlace Plane -gaussian-blur 0.05 -quality 65% 1.jpg result.jpg

I need to do this convert for a batch of images. i tried this but it is not working

   mogrify -path \images-rep  -strip -interlace Plane -gaussian-blur 0.05 -quality 66% *.jpg

Upvotes: 14

Views: 10495

Answers (3)

Cloy
Cloy

Reputation: 2181

Reduce the depth of the image will reduce the size of the image

-depth 5

Upvotes: 2

Camille Goudeseune
Camille Goudeseune

Reputation: 3162

To specify a maximum file size, mogrify -define jpeg:extent=300kb *.jpg. However, this can be much slower than just -quality 50% and/or -resize 50%. https://stackoverflow.com/a/11920384/2097284

Upvotes: 3

Prasath Bala
Prasath Bala

Reputation: 728

Use this command to convert your batch of images under a folder

   mogrify -path imagepath  -strip -quality 50% *.jpg

Upvotes: 17

Related Questions