Ubuntu / Debian installation command:
sudo apt-get install jpegoptim
Let’s go to the directory with the images:
cd /var/www/site/images/
Run jpegoptim to delete all text information (comments, shooting date, aperture size, etc.) in jpg images that are in the current directory (without subdirectories):
sudo jpegoptim *.jpg --strip-all
Since we started jpegoptim via sudo, it’s possible that all images will have the owner changed to root (because of this image may not be displayed on the site), so we’ll return the previous owner, for example like this:
sudo chown -R www-data:www-data /var/www/
I will give a list of possible launch options and describe them:
-d path, –dest=DIR (specifying a directory for saving modified images)
-f, –force (force optimization, even if the result increases the image size)
-h (help)
-m quality, –max=quality (compression level, 0 – 100)
-n, –noaction (do not optimize, only display information)
-S size, –size=SIZE (image optimization to the specified size in kilobytes (1 – ..) or as a percentage of the original (1% – 99%)
-T threshold, –threshold=threshold (do not modify the file if the compression level is below the specified 0 – 100%)
-o, –overwrite (overwrite files if they exist, used when specifying the -d option)
-p, –preserve (save file modification time)
-q, –quiet (silent mode)
-t, –totals (display totals after processing all files)
-v, –verbose (verbose mode, more info is displayed)
–all-normal (force all output files to be non-progressive)
–all-progressive (force all output files to be progressive)
–strip-all (remove all markers and comments on images)
–strip-com (remove only comments)
–strip-exif (remove only EXIF markers)
–strip-iptc (remove only IPTC tokens)
–strip-icc (remove only ICC profiles)