Skip to main content

README.md

1# create_thumbnail
3This is a simple command-line tool for creating image thumbnails.
5It takes three arguments:
7* Your original image;
8* The directory where you're storing thumbnails;
9* The max allowed height and/or width of the thumbnail you want.
10 It resizes the image to fit, preserving the aspect ratio of the original image.
12The tool prints the path to the newly-created thumbnail.
13Here are two examples:
15```console
16$ create_thumbnail clever_cat.jpg --out-dir=thumbnails --width=100
17./thumbnails/clever_cat.jpg
19$ create_thumbnail dappy_dog.png --out-dir=thumbnails --height=250
20./thumbnails/dappy_dog.png
22$ create_thumbnail --help
23Usage: create_thumbnail --out-dir <OUT_DIR> <--height <HEIGHT>|--width <WIDTH>> <PATH>
24```
26It supports JPEG, PNG, TIFF, WEBP, and both static and animated GIFs.
27Thumbnails match the format of the original image, except for animated GIFs, which become MP4 movies.
29This tool only does one thing: it creates thumbnails that I like.
30I need image thumbnails in a lot of projects, and I wanted a single tool I could use in all of them rather than having multiple copies of the same code.
32You might prefer to look at flexible tools like ImageMagick or ffmpeg, which have more customisation to fit a wider variety of use cases.
37## Installation
39You can download compiled binaries from the [GitHub releases](https://github.com/alexwlchan/create_thumbnail/releases).
41Alternatively, you can install from source.
42You need Rust installed; I recommend using [Rustup].
43Then clone this repository and compile the code:
45```console
46$ git clone "https://github.com/alexwlchan/create_thumbnail.git"
47$ cd dominant_colours
48$ cargo install --path .
49```
51For animated GIF support, you additionally need to install `ffmpeg`.
53[Rustup]: https://rustup.rs/
57## License
59MIT.