|
7 | 7 |
|
8 | 8 | Refract is a cross-platform[\*](#installation) guided image conversion tool. |
9 | 9 |
|
10 | | -It takes [JPEG](https://en.wikipedia.org/wiki/JPEG) and [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) image sources and produces [AVIF](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)), [JPEG XL](https://en.wikipedia.org/wiki/JPEG_XL), and [WebP](https://en.wikipedia.org/wiki/WebP) clones. |
| 10 | +It takes [JPEG](https://en.wikipedia.org/wiki/JPEG) and [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) image sources and produces [AVIF](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)), [JPEG XL](https://en.wikipedia.org/wiki/JPEG_XL), and [WebP](https://en.wikipedia.org/wiki/WebP) copies. |
11 | 11 |
|
12 | 12 | <img src="https://github.com/Blobfolio/refract/raw/master/skel/gallery/screen0.png" width="45%" alt="Viewing a PNG source."></img> <img src="https://github.com/Blobfolio/refract/raw/master/skel/gallery/screen1.png" width="45%" alt="Viewing a (crappy) WebP copy."></img> |
13 | 13 |
|
14 | | -The program works something like an optometrist's refraction test, presenting a series of feedback-driven candidate images — what looks better, this… or this? This… or this? — until the subjective "best" option is found (or found to be impossible). |
| 14 | +The program is named for and works something like an optometrist's refraction test, presenting a series of feedback-driven candidate images — what looks better, this… or this? This… or this? — until the subjective "best" option is found (or found to be impossible). |
15 | 15 |
|
16 | 16 | Hence "guided". |
17 | 17 |
|
18 | 18 | The beauty of this sort of approach is it moots the need for exhaustive testing. |
19 | 19 |
|
20 | | -Every yay and nay you provide effectively halve the number of possibilities remaining to be tested. The ideal copy, whatever and wherever that might be, can be found in a handful of steps instead of a hundred. |
| 20 | +Every Yay and Nay you provide halve the number of possibilities remaining to be tested. The ideal copy, whatever and wherever it might be, can be found in a handful of steps instead of a hundred. |
21 | 21 |
|
22 | 22 |
|
23 | 23 |
|
24 | 24 | ## Why? |
25 | 25 |
|
26 | 26 | Every image is different. |
27 | 27 |
|
28 | | -There is no such thing as a one-size-fits-all quality setting. |
| 28 | +There is no such thing as a one-size-fits-all quality setting, or even a one-size-fits-all image format. |
29 | 29 |
|
30 | 30 | Whether you're looking for perfect copies or merely passable ones, the only way to be sure you're not producing over- or under-compressed images is to _use your eyes_. |
31 | 31 |
|
@@ -53,19 +53,36 @@ Refract implements [`libavif`](https://github.com/AOMediaCodec/libavif), [`libjx |
53 | 53 |
|
54 | 54 | All conversion takes place at Pixel Level and is intended for displays with an sRGB color space (e.g. web browsers). Gamma correction, color profiles, and other metadata are ignored and stripped out when saving next-gen copies. |
55 | 55 |
|
56 | | -File sizes are taken into account as well; refract will only suggest/save conversions that wind up smaller than the sources. (Otherwise what's the point?) |
| 56 | +All conversions are performed using the maximum/slowest (general) encoder settings, ensuring the smallest possible output. Refract also explicitly tracks the input and output file sizes to save you having to review counter-productive combinations. |
57 | 57 |
|
58 | 58 |
|
59 | 59 |
|
60 | 60 | ## Usage |
61 | 61 |
|
62 | 62 | Refract is pretty straightforward: |
63 | 63 |
|
64 | | -1. Choose the output formats (and other settings); |
| 64 | +0. Open the program; |
| 65 | +1. Choose the output format(s) and tweak any other settings you want; |
65 | 66 | 2. Choose one or more JPEG/PNG source files to crunch; |
66 | 67 | 3. Sit back and wait for the feedback prompts; |
67 | 68 |
|
68 | | -For best results, be sure to optimize your input sources _before_ re-encoding them with refract. (The CLI tool [flaca](https://github.com/Blobfolio/flaca) is great for this, and fully automatic.) |
| 69 | +### Feedback |
| 70 | + |
| 71 | +Lossless conversions require no human supervision. Being lossless, all that really matters is that shit gets smaller, and refract can figure _that_ out on its own. ;) |
| 72 | + |
| 73 | +Lossy conversions are another matter since, by their very nature, information is lost in translation. |
| 74 | + |
| 75 | +For those, refract will present a series of "candidate" images to you, one at a time, in a simple A/B fashion for easy comparison with the original sources. |
| 76 | + |
| 77 | +The "feedback" comes in the form of two buttons — "reject" and "accept" — which can be thought of as answers to the question: Are you happy with this copy? |
| 78 | + |
| 79 | +If it looks like what you want it to, great!, accept it. If not, reject it. Refract will raise or lower the quality of the next candidate accordingly. |
| 80 | + |
| 81 | +Rinse and repeat. |
| 82 | + |
| 83 | +The smallest of the accepted candidates, if any, will be saved to disk at the end of the process, the rest forgotten like a passing dream. |
| 84 | + |
| 85 | +Then it's back around again for the next input/output pair! |
69 | 86 |
|
70 | 87 |
|
71 | 88 |
|
@@ -97,29 +114,31 @@ refract [FLAGS] [OPTIONS] <PATH(S)>... |
97 | 114 |
|
98 | 115 | ## Installation |
99 | 116 |
|
100 | | -Debian and Ubuntu users with x86-64 CPUs can just grab the pre-built `.deb` package from the [release page](https://github.com/Blobfolio/refract/releases/latest), and Arch Linux users can pull it from [AUR](https://aur.archlinux.org/packages/refract-bin) (community-maintained). |
| 117 | +Pre-built packages for x86-64 CPU architectures are available for Debian and Ubuntu users on the [release page](https://github.com/Blobfolio/refract/releases/latest), and to Arch Linux users via [AUR](https://aur.archlinux.org/packages/refract-bin). |
101 | 118 |
|
102 | | -To use refract in other environments, it needs to be built from source. |
| 119 | +To use refract in other environments, it'll needs to be built from source. |
103 | 120 |
|
104 | 121 | Thankfully, [Rust](https://www.rust-lang.org/)/[Cargo](https://github.com/rust-lang/cargo) make this pretty easy: |
105 | 122 |
|
106 | 123 | ```bash |
107 | | -# Install the build dependencies. Ubuntu and debian users, for example, |
| 124 | +# Install the build dependencies. Ubuntu and Debian users, for example, |
108 | 125 | # can run: |
109 | 126 | sudo apt-get install -y cmake g++ gcc git make nasm ninja-build |
110 | 127 |
|
111 | | -# See "cargo install --help" for more options. |
| 128 | +# Build and install refract: |
112 | 129 | cargo install \ |
113 | 130 | --git https://github.com/Blobfolio/refract.git \ |
114 | 131 | --bin refract |
115 | 132 | ``` |
116 | 133 |
|
117 | 134 | ### Build Dependencies |
118 | 135 |
|
119 | | -The extra build dependencies (required by all the damn image codecs) will vary by environment, but at a minimum you'll need C and C++ compilers, `cmake`, `git` (obviously), `make`, `nasm`, and `ninja-build`. |
| 136 | +The extra build dependencies (required by all the damn image codecs) will vary by environment, but at a minimum you'll need up-to-date C and C++ compilers, `cmake`, `git` (obviously), `make`, `nasm`, and `ninja-build`. |
120 | 137 |
|
121 | 138 | Cargo should pop an error if anything's missing. If that happens, just find/install the missing dep and give `cargo install` another shot. |
122 | 139 |
|
| 140 | +If you wind up needing something not on this list, please [open an issue](https://github.com/Blobfolio/refract/issues) so it can be given a mention. ;) |
| 141 | + |
123 | 142 | ### Runtime Dependencies |
124 | 143 |
|
125 | 144 | On Linux, the file dialogues require one of `xdg-desktop-portal-[gnome, gtk, kde]` or `zenity`, user's choice. |
|
0 commit comments