I have a batch of images I want to compress. There are hundreds, so I'd like to use CLI tools.
The images have the following characteristics.
$ identify 100.jpg 100.jpg JPEG 639x426 639x426+0+0 8-bit sRGB 319KB
If I resize them with GIMP and export with these settings
I get a 20kB file of very acceptable quality.
$ identify c.jpg c.jpg JPEG 400x267 400x267+0+0 8-bit sRGB 20KB
If I resize it with Imagemagick's convert, however, as follows
$ convert 100.jpg -quality 50% -resize 400x267 c_im.jpg
I get a much larger file, without significant improvements in quality.
$ identify c_im.jpg c_im.jpg JPEG 400x267 400x267+0+0 8-bit sRGB 86.6KB
Even if I reduce the quality or the size further, I cannot get a file as small as what GIMP produces, unless I go so far that the image degenerates beyond recognition.
And even if I tick the EXIF and thumbnail boxes in GIMP, the size only grows up to about 43kB.
Is there a way to obtain the compression levels of GIMP with CLI tools, or in some automated manner?