Skip to content

Commit

Permalink
feat: Add WebP encoding support (#34)
Browse files Browse the repository at this point in the history
* feat: Add WebP encoding support

* doc: Update documentation about WebP support
  • Loading branch information
orhun authored Mar 1, 2023
1 parent 102c2b7 commit 68f6c46
Show file tree
Hide file tree
Showing 17 changed files with 1,182 additions and 10 deletions.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ x11 = { version = "2.21.0", features = ["xlib", "xrandr"] }
device_query = "1.1.2"
ctrlc = { version = "3.2.5", features = ["termination"] }
# image operations
image = "0.24.5"
image = { version = "0.24.5", features = ["webp-encoder"] }
imgref = { version = "1.9.4", optional = true }
rgb = { version = "0.8.36", optional = true }
png = "0.17.7"
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
- [GIF/APNG](#gifapng)
- [PNG](#png)
- [JPG](#jpg)
- [WEBP](#webp)
- [PNM](#pnm)
- [Save](#save)
- [Key Bindings](#key-bindings)
Expand Down Expand Up @@ -122,7 +123,7 @@
- [x] [TGA](https://en.wikipedia.org/wiki/Truevision_TGA)
- [x] [farbfeld](https://tools.suckless.org/farbfeld/)
- [x] [OpenEXR](https://en.wikipedia.org/wiki/OpenEXR)
- [ ] [WebP](https://en.wikipedia.org/wiki/WebP)
- [x] [WebP](https://en.wikipedia.org/wiki/WebP)
- [ ] [AVIF](https://en.wikipedia.org/wiki/AV1)
- [ ] [MP4](https://en.wikipedia.org/wiki/MPEG-4_Part_14)

Expand Down Expand Up @@ -401,6 +402,7 @@ ARGS:
SUBCOMMANDS:
png Use the PNG encoder
jpg Use the JPG encoder
webp Use the WebP encoder
bmp Use the BMP encoder
ico Use the ICO encoder
tiff Use the TIFF encoder
Expand Down Expand Up @@ -493,6 +495,7 @@ ARGS:
SUBCOMMANDS:
png Use the PNG encoder
jpg Use the JPG encoder
webp Use the WebP encoder
bmp Use the BMP encoder
ico Use the ICO encoder
tiff Use the TIFF encoder
Expand All @@ -515,6 +518,7 @@ SUBCOMMANDS:
| `menyoki capture --mouse` | Screenshot the selected window with a mouse click |
| `menyoki capture png --filter avg --compression fast` | Screenshot and encode with the specified PNG options |
| `menyoki capture jpg --quality 100` | Screenshot and encode with the specified JPEG options |
| `menyoki capture webp --lossless` | Screenshot and encode with the specified WEBP options |
| `menyoki capture pnm --format pixmap --encoding ascii` | Screenshot and encode with the specified PNM options |
| `menyoki capture ff save "test.ff" --timestamp` | Screenshot and save as "test.ff" in farbfeld format with timestamp in the file name |
| `menyoki -q capture png save "-" > test.png` | Screenshot and redirect output to "test.png" |
Expand Down Expand Up @@ -559,6 +563,7 @@ SUBCOMMANDS:
apng Use the APNG encoder
png Use the PNG encoder
jpg Use the JPG encoder
webp Use the WebP encoder
bmp Use the BMP encoder
ico Use the ICO encoder
tiff Use the TIFF encoder
Expand Down Expand Up @@ -780,6 +785,20 @@ SUBCOMMANDS:
save Save the output file(s)
```

#### WEBP

```
FLAGS:
-l, --lossless Use lossless encoding
-h, --help Print help information
OPTIONS:
-q, --quality <QUALITY> Set the lossy encoding quality (1-100) [default: 80]
SUBCOMMANDS:
save Save the output file(s)
```

#### PNM

```
Expand Down Expand Up @@ -964,6 +983,10 @@ filter = sub
[jpg]
quality = 90

[webp]
quality = 80
lossless = false

[pnm]
format = pixmap
encoding = binary
Expand Down
Loading

0 comments on commit 68f6c46

Please sign in to comment.