Skip to content

Commit 06521f9

Browse files
committed
feat: improve CLI defaults; use crates.io league-toolkit
1 parent 8234e8c commit 06521f9

File tree

6 files changed

+330
-75
lines changed

6 files changed

+330
-75
lines changed

Cargo.lock

Lines changed: 187 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ clap = { version = "4.5.20", features = ["derive"] }
99
eyre = "0.6.12"
1010
color-eyre = "0.6"
1111
colored = "2"
12-
league-toolkit = { git = "https://github.com/LeagueToolkit/league-toolkit", rev = "d44b64f7a484081473a3e4a71a7e96d5ca0f0615", features = [
13-
"texture",
14-
"file",
15-
] }
12+
league-toolkit = { version = "0.2.11", features = ["texture", "file"] }
13+
ltk_texture = { version = "*", features = ["intel-tex"] }
1614
tracing = "0.1.41"
1715
tracing-subscriber = { version = "0.3.2", features = ["local-time"] }
1816

1917
image = { version = "0.25.2" }
2018

2119
[workspace]
22-
members = [
23-
"crates/*",
24-
]
20+
members = ["crates/*"]

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ Encode an image into `.tex`.
8888

8989
```bash
9090
ltk-tex-utils encode \
91-
-i path/to/input.png \
92-
-o path/to/output.tex \
91+
path/to/input.png \
9392
-f <bc1|bc3|bgra8> \
9493
-m <true|false> \
9594
--mipmap-filter <nearest|triangle|catmullrom|lanczos3>
@@ -98,30 +97,32 @@ ltk-tex-utils encode \
9897
Notes:
9998
- `-m/--generate-mipmaps` defaults to `true`. Pass `-m false` to disable mipmap generation.
10099
- The input image is read via the `image` crate and supports common formats like PNG, JPEG, BMP, TIFF, TGA, etc.
100+
- If `-o/--output` is not provided, output is written next to the input with the same name and a `.tex` extension.
101101

102102
Examples:
103103

104104
```bash
105105
# BC3 with default mipmaps (triangle)
106-
ltk-tex-utils encode -i albedo.png -o albedo.tex -f bc3
106+
ltk-tex-utils encode albedo.png -f bc3
107107

108108
# Disable mipmaps
109-
ltk-tex-utils encode -i icon.png -o icon.tex -f bgra8 -m false
109+
ltk-tex-utils encode icon.png -f bgra8 -m false
110110

111111
# BC1 with a different mipmap filter
112-
ltk-tex-utils encode -i mask.png -o mask.tex -f bc1 --mipmap-filter lanczos3
112+
ltk-tex-utils encode mask.png -f bc1 --mipmap-filter lanczos3
113113
```
114114

115115
#### decode
116116
Decode a `.tex` file into a standard image.
117117

118118
```bash
119-
ltk-tex-utils decode -i path/to/input.tex -o path/to/output.png
119+
ltk-tex-utils decode path/to/input.tex
120120
```
121121

122122
Notes:
123123
- The output image format is inferred from the file extension (e.g., `.png`, `.jpg`, `.tiff`).
124124
- Currently decodes the top-level mip (mip 0).
125+
- If `-o/--output` is not provided, output is written next to the input with the same name and a `.png` extension.
125126

126127
### Supported formats and filters
127128

@@ -145,8 +146,8 @@ Examples:
145146

146147
```bash
147148
cargo run -- info -i samples/texture.tex
148-
cargo run -- encode -i samples/albedo.png -o out/albedo.tex -f bc3
149-
cargo run -- decode -i samples/texture.tex -o out/texture.png
149+
cargo run -- encode samples/albedo.png -f bc3
150+
cargo run -- decode samples/texture.tex
150151
```
151152

152153
### Acknowledgements

0 commit comments

Comments
 (0)