A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
-bash/zsh: jpegoptim command not found # Windows (WSL2) sudo apt-get update sudo apt-get install jpegoptim # Debian apt-get install jpegoptim # Ubuntu apt-get install jpegoptim # Alpine apk add jpegoptim # Arch Linux pacman -S jpegoptim # Kali Linux apt-get install jpegoptim # Fedora dnf install jpegoptim # OS X brew install jpegoptim # Raspbian apt-get install jpegoptim # Dockerfile dockerfile.run/jpegoptim # Docker docker run cmd.cat/jpegoptim jpegoptim
jpegoptim 用于优化 JPEG 图像,在 Windows、MacOS、Linux 都经过了测试,jpegoptim 安装非常简单,只需解压 tar 文件,对 Makefile 进行必要的更改,然后编译程序即可。类似如下操作:
tar xzvf jpegoptim-1.5.6.tar.gz cd jpegoptim-1.5.6 ./configure make make strip make install
jpegoptim [ options ] [ filenames ]
-d<path>, --dest=<path> Sets alternative destination directory where to save optimized files (default is to overwrite the originals). Please note that unchanged files won't be added to the destination directory. This means if the source file can't be compressed, no file will be created in the destination path. -f, --force Force optimization, even if the result would be larger than the original file. -h, --help Displays short usage information and exits. -m<quality>, --max=<quality> Sets the maximum image quality factor (disables lossless optimization mode, which is by default enabled). This option will reduce quality of those source files that were saved using higher quality setting. While files that already have lower quality setting will be compressed using the lossless optimization method. Valid values for quality parameter are: 0 - 100 -n, --noaction Don't really optimize files, just print results. -S<size>, --size=<size> Try to optimize file to given size (disables lossless optimization mode). Target size is specified either in kilobytes (1 - n) or as percentage (1% - 99%) of the original file size. -T<threshold>, --threshold=<threshold> Keep the file unchanged if the compression gain is lower than the threshold (%). Valid values for threshold are: 0 - 100 -b, --csv Print progress info in CSV format. -o, --overwrite Overwrite target file even if it exists (when using -d option). -p, --preserve Preserve file modification times. -P, --preserve-perms Preserve file permissions (owner/group) by overwriting the original file. This is slightly less safe than the default mode of operation (where new file is first saved as temporary file and then renamed over the original file). In this mode a backup of the original file is made with .jpegoptim.bak extension, and this file is removed after the original file has been successfully replaced. NOTE! if running jpegoptim as root there is generally no need to use this option, as jpegoptim is able to preserve file permissions when run by root in default mode. -q, --quiet Quiet mode. -t, --totals Print totals after processing all files. -v, --verbose Enables verbose mode (positively chatty). --all-normal Force all output files to be non-progressive. Can be used to convert all input files to non-progressive JPEGs when used with --force option. --all-progressive Force all output files to be progressive. Can be used to convert all normal (non-progressive) JPEGs input files to progressive when used with --force option. --all-arith Force all output files to use Arithmetic Coding. This option is experimental and only available if jpegoptim was compiled with Arithmetic Coding support enabled. --all-huffman Force all output files to use (traditional) Huffman coding. This option is experimental and only available if jpegoptim was compiled with Arithmetic Coding support enabled. --nofix Skip processing of any input files that have any errors/warnings during decompression. By default jpegoptim will attempt to optimize any file that it is able to decompress, even if decompression generates warnings. This will 'fix' some (corrupt) JPEG images automatically. If this behaviour is not desired, this option can be used to make jpegoptim to skip any input files that contain any errors. --stdout Send output image to standard output. Note, if optimization didn't create smaller file than the input file, then no output original image is passed through unmodified (except any extra data after JPEG image will be discarded). --stdin Read input image from standard input and send output to standard output (--stdout is assumend when this option is used). When this option is used then only one image is read from standard input. Any (other) input files specified on command-line are ignored. Note, if input file '-' is seen on command line then standard input is also assumed.
-s, --strip-all Strip all markers from output file. (NOTE! by default only Comment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything else is discarded). Output JPEG still likely will contains one or two markers (JFIF and Adobe APP14) depending on colorspace used in the image, as these markers are generated by the libjpeg encoder automatically. --strip-none Preserve "all" markers in the image. This will leave all markers untouched in the image, except JFIF (APP0) and Adobe (APP14) markers as those get regenerated by the libjpeg library. NOTE! If this option is specified then any other --strip-* or --keep-* options are ignored. --strip-com Strip Comment (COM) markers from output file. --strip-exif Strip EXIF markers from output file. --strip-iptc Strip IPTC / Adobe Photoshop (APP13) markers from output file. --strip-icc Strip ICC profiles from output file. --strip-xmp Strip XMP profiles from output file. --strip-jfxx Strip JFXX (JFIF Extensions) from output file. --strip-Adobe Strip Adobe markers from output file. --keep-com Do not strip any Comment (COM) markers from output file. --keep-exif Do not strip any EXIF markers from output file. --keep-iptc Do not strip any IPTC / Adobe Photoshop (APP13) markers from output file. --keep-icc Do not strip any ICC profiles from output file. --keep-xmp Do not strip any XMP profiles from output file. --strip-jfxx Do not strip any JFXX (JFIF Extensions) from output file. --keep-Adobe Do not strip Adobe markers from output file.
jpegoptim 优化一组 JPEG 图像,保留所有相关数据:
jpegoptim image1.jpeg image2.jpeg imageN.jpeg
jpegoptim 优化 JPEG 图像,删除所有非必要数据:
jpegoptim --strip-all image1.jpeg image2.jpeg imageN.jpeg
jpegoptim 强制输出图像为渐进式:
jpegoptim --all-progressive image1.jpeg image2.jpeg imageN.jpeg
jpegoptim 强制输出图像具有固定的最大文件大小:
jpegoptim --size=250k image1.jpeg image2.jpeg imageN.jpeg