Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This is CLI tool inspired by squoosh!

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

SalOne22/rimage

build statusdocs.rsversionlicense

A powerful Rust image optimization CLI tool inspired bysquoosh!.

⚠️ WARNING: This documentation works only for latest version of rimage! You can get latest version fromreleases tab or explicitly with cargo:cargo install rimage@0.11.0-next.3

Features

  • Modern codecs:
    • Rimage uses modern codecs optimized to produce tiny images
    • Under the hood useszune_image crate that enhances performance
  • Optimization operations:
    • Rimage provides several image optimization operation
    • Resize - usesfast_image_resize crate that has incredible performance
    • Quantization - allowing to reduce image palette

Installation

You can download latest release from thereleases tab.

If you're a Rust programmer, rimage can be installed withcargo.

cargo install rimage

Alternatively, one can usecargo binstall to install a rimage binary directly from GitHub:

cargo binstall rimage

Note

If you're a user who just want touse Rimage easily with a friendly GUI,Rimage_gui may be fit for you, it support both Chinese and English. Just select the version you need and download it to use.

Usage

Optimize images natively with best-in-class codecsUsage: rimage [COMMAND]Commands:  avif      Encode images into AVIF format. (Small and Efficient)  farbfeld  Encode images into Farbfeld format. (Bitmapped)  jpeg      Encode images into JPEG format. (Progressive-able)  jpeg_xl   Encode images into JpegXL format. (Big but Lossless)  mozjpeg   Encode images into JPEG format using MozJpeg codec. (RECOMMENDED and Small)  oxipng    Encode images into PNG format using OxiPNG codec. (Progressive-able)  png       Encode images into PNG format.  ppm       Encode images into PPM format. (Bitmapped)  qoi       Encode images into QOI format. (Trendy and Small)  webp      Encode images into WebP format. (Lossless-able)  help      Print this message or the help of the given subcommand(s)Options:  -h, --help     Print help  -V, --version  Print version

Basic optimization suitable for web

To optimize images with great defaults, you can simply callrimage <command>. For example:

rimage mozjpeg ./image.jpg

By default rimage will place output images right in place of precious images, resulting in overwrite if input and output has the same format. To change this behavior you can use this options:

# will place output images in `./output` directory, images may be overwritten if has the same namerimage mozjpeg -d ./output ./image.jpg# will rename all input files before processing with `@backup` suffixrimage mozjpeg --backup ./image.jpg# will place output images in ./output directory preserving folder structurerimage mozjpeg -d ./output -r ./inner/image.jpg ./image.jpg

Preprocessing

Rimage has pipeline preprocessing options. Simple usage:

# will resize image to specified dimensionsrimage mozjpeg --resize 500x200 ./image.jpg

If you want to run preprocessing pipeline in specific order, you can do this:

# will quantize image with 80% quality, after run resize to 64x64 pixels using the Nearest filter.rimage mozjpeg --quantization 80 --resize 64x64 --filter nearest ./image.jpg# will resize image to 64x64 pixels using the Nearest filter, and after run quantization with 80% quality.rimage mozjpeg --resize 64x64 --filter nearest --quantization 80 ./image.jpg

Note that some preprocessing option are order independent. For example filter option, will apply resize filter to all resize invocations. Same for dithering, applies to every quantization invocations.

Advanced options

If you want customize optimization you can provide additional options to encoders. For mozjpeg this options are valid:

Options:  -q, --quality <NUM>         Quality, values 60-80 are recommended. [default: 75]      --chroma_quality <NUM>  Separate chrome quality.      --baseline              Set to use baseline encoding (by default is progressive).      --no_optimize_coding    Set to make files larger for no reason.      --smoothing <NUM>       Use MozJPEG's smoothing.      --colorspace <COLOR>    Set color space of JPEG being written. [default: ycbcr] [possible values: ycbcr, grayscale, rgb]      --multipass             Specifies whether multiple scans should be considered during trellis quantization.      --subsample <PIX>       Sets chroma subsampling.      --qtable <TABLE>        Use a specific quantization table. [default: NRobidoux] [possible values: AhumadaWatsonPeterson, AnnexK, Flat, KleinSilversteinCarney, MSSSIM, NRobidoux, PSNRHVS, PetersonAhumadaWatson, WatsonTaylorBorthwick]

For more info userimage help <command>

For library usage checkDocs.rs

List of supported Codecs

Image CodecsDecoderEncoderNOTE
aviflibavifravifCommon features only, Static only
bmpzune-bmpXInput only
farbfeldzune-farbfeldzune-farbfeld
hdrzune-hdrzune-hdr
jpegzune-jpegmozjpeg or jpeg-encoderMultifunctional when use mozjpeg encoder
jpeg-xljxl-oxidezune-jpegxlLossless only
pngzune-pngoxipng or zune-pngStatic only, Multifunctional when use oxipng encoder
ppmzune-ppmzune-ppm
psdzune-psdXInput only
qoizune-qoizune-qoi
webpwebpwebpStatic only

List of supported preprocessing options

  • Resize
  • Quantization
  • Alpha premultiply

Known bugs

  • Dir path end with\ may cause rimage crashes due to a cmd bug#72653.

Example:

This will crash:

rimage png"D:\example.jpg" -d"D:\desktop\" -s"suffix"

This will work as expected:

rimage png"D:\example.jpg" -d"D:\desktop" -s"suf test"# without trailing backslashrimage png"D:\example.jpg" -s"suffix"  -d"D:\desktop\" # backslash at the end

Contributing

Read thecontribution guide for build instructions and guidelines.

License

Rimage is dual-licensed underApache License 2.0 andMIT License. You can choose either license for your use.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Changelog

View theChangelog for version-specific changes.


[8]ページ先頭

©2009-2025 Movatter.jp