What is the best way to shrink JPG file size to a given number, e.g., ~100KB without significantly changing the pixel dimensions, color, or dpi resolution.
On Windows, I had no problem (using Irfanview freeware with the right plugin) shrinking JPEG files to 'around' a given file size (e.g., 100KB) simply at the click of a checkbox. The results were 'around' the desired file size (usually plus or minus something like 10% to 20%), which was an attempt at the software to do the best it could using a variety of selectable filters. (Irfanview will even automatically 'ignore' files that are already below the file size set limit & with another checkbox, it will strip out the EXIF header & thumbnail information).
However, on Ubuntu, I can't seem to figure out what's best to shrink JPG file size to around a given number.
Of course I resize to the desired pixel dimensions first (e.g., using the RESIZE feature of Nautilus to resize to 640x480 pixels or "convert * -strip -auto-orient -resize 640x480 -quality 75 *.jpg); but, once the pixel dimensions are set, I no longer want to change dimensions to get the file size down ... but sometimes I still need to reduce the file size closer to a given desired file size for a large directory of photos.
Certainly ImageMagick has a "resize" option, but that option resizes the pixel dimension, which is NOT what is needed here:
Of course, with trial and error on the "-quality" setting, one can 'approximate' what is needed:Code:convert -resize 50% -quality 80 input.jpg output.jpg
But, without trial and error approaches for potentially hundreds of photos at a time, what's the best way to shrink a directory of photos to (around) a given file size in KB (plus or minus 10% or 20%) simply by specifying the desired target file size?Code:mogrify -format jpg -quality 75 -resize "640x480>" -strip *