Linux – How do I batch resize images to a maximum of 2MB from the command line?

How do I batch resize images to a maximum of 2MB from the command line?… here is a solution to the problem.

How do I batch resize images to a maximum of 2MB from the command line?

I

looked at ImageMagick’s convert and mogrify and wasn’t sure how I should specify the maximum file size when compressing. What am I going to do?

Solution

The first Google result: https://www.google.com/search?gcx=c&ix=c2&sourceid=chrome&ie=UTF-8&q=ImageMagick’s+max+file+size

Link: http://www.imagemagick.org/script/command-line-options.php

jpeg:extent=value
Restrict the maximum JPEG file size, for example -define jpeg:extent=400kb.

Related Problems and Solutions