Add support for TIFF images
- ID
c88dfd4- date
2022-10-16 19:36:02+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
1c14e2b- message
Add support for TIFF images- changed files
5 files, 27 additions, 5 deletions
Changed files
CHANGELOG.md (519) → CHANGELOG.md (573)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f22fee3..b0b1976 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## v1.1.2 - 2022-10-16
+
+Add support for TIFF images.
+
## v1.1.1 - 2022-04-03
Publish binaries as part of the GitHub releases.
Cargo.lock (13194) → Cargo.lock (13448)
diff --git a/Cargo.lock b/Cargo.lock
index de94d8e..1e5f8dd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -136,7 +136,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "dominant_colours"
-version = "1.1.1"
+version = "1.1.2"
dependencies = [
"assert_cmd",
"clap",
@@ -205,6 +205,7 @@ dependencies = [
"num-rational",
"num-traits",
"png",
+ "tiff",
]
[[package]]
@@ -444,6 +445,17 @@ dependencies = [
]
[[package]]
+name = "tiff"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7259662e32d1e219321eb309d5f9d898b779769d81b76e762c07c8e5d38fcb65"
+dependencies = [
+ "flate2",
+ "jpeg-decoder",
+ "weezl",
+]
+
+[[package]]
name = "unicode-width"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
Cargo.toml (406) → Cargo.toml (414)
diff --git a/Cargo.toml b/Cargo.toml
index 010ad1b..8fef77b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "dominant_colours"
-version = "1.1.1"
+version = "1.1.2"
edition = "2018"
[dependencies]
@@ -14,7 +14,7 @@ default-features = false
[dependencies.image]
version = "0.24"
-features = ["jpeg", "png", "gif"]
+features = ["jpeg", "png", "gif", "tiff"]
default-features = false
[dependencies.palette]
src/main.rs (9076) → src/main.rs (9257)
diff --git a/src/main.rs b/src/main.rs
index bf62e19..8e37f47 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -135,6 +135,12 @@ mod tests {
}
#[test]
+ fn it_can_look_at_tiff_images() {
+ let output = get_success(&["./src/tests/green.tiff", "--max-colours=1"]);
+ assert_eq!(output.exit_code, 0);
+ }
+
+ #[test]
fn it_omits_the_escape_codes_with_no_palette() {
let output = get_success(&["./src/tests/red.png", "--max-colours=1", "--no-palette"]);
@@ -247,11 +253,11 @@ mod tests {
#[test]
fn it_fails_if_you_pass_an_unsupported_image_format() {
- let output = get_failure(&["./src/tests/green.tiff"]);
+ let output = get_failure(&["./src/tests/purple.webp"]);
assert_eq!(output.exit_code, 1);
assert_eq!(output.stdout, "");
- assert_eq!(output.stderr, "The image format Tiff is not supported\n");
+ assert_eq!(output.stderr, "The image format WebP is not supported\n");
}
#[test]
src/tests/purple.webp (0) → src/tests/purple.webp (66)
diff --git a/src/tests/purple.webp b/src/tests/purple.webp
new file mode 100644
index 0000000..71e78a1
Binary files /dev/null and b/src/tests/purple.webp differ