Skip to content

Commit dc4e3c2

Browse files
authored
Merge pull request #17 from alexwlchan/add-tif-support
Add support for TIFF images
2 parents 85163f1 + 7866176 commit dc4e3c2

File tree

6 files changed

+61
-45
lines changed

6 files changed

+61
-45
lines changed

.github/workflows/build.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
28
name: build
39
jobs:
410
build:

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.1.2 - 2022-10-16
4+
5+
Add support for TIFF images.
6+
37
## v1.1.1 - 2022-04-03
48

59
Publish binaries as part of the GitHub releases.

Cargo.lock

+38-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dominant_colours"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
edition = "2018"
55

66
[dependencies]
@@ -13,8 +13,8 @@ features = ["palette_color"]
1313
default-features = false
1414

1515
[dependencies.image]
16-
version = "0.23"
17-
features = ["jpeg", "png", "gif"]
16+
version = "0.24"
17+
features = ["jpeg", "png", "gif", "tiff"]
1818
default-features = false
1919

2020
[dependencies.palette]

src/main.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ mod tests {
134134
assert_eq!(output.exit_code, 0);
135135
}
136136

137+
#[test]
138+
fn it_can_look_at_tiff_images() {
139+
let output = get_success(&["./src/tests/green.tiff", "--max-colours=1"]);
140+
assert_eq!(output.exit_code, 0);
141+
}
142+
137143
#[test]
138144
fn it_omits_the_escape_codes_with_no_palette() {
139145
let output = get_success(&["./src/tests/red.png", "--max-colours=1", "--no-palette"]);
@@ -247,11 +253,11 @@ mod tests {
247253

248254
#[test]
249255
fn it_fails_if_you_pass_an_unsupported_image_format() {
250-
let output = get_failure(&["./src/tests/green.tiff"]);
256+
let output = get_failure(&["./src/tests/purple.webp"]);
251257

252258
assert_eq!(output.exit_code, 1);
253259
assert_eq!(output.stdout, "");
254-
assert_eq!(output.stderr, "The image format Tiff is not supported\n");
260+
assert_eq!(output.stderr, "The image format WebP is not supported\n");
255261
}
256262

257263
#[test]
@@ -262,7 +268,7 @@ mod tests {
262268
assert_eq!(output.stdout, "");
263269
assert_eq!(
264270
output.stderr,
265-
"Format error decoding Png: invalid signature\n"
271+
"Format error decoding Png: Invalid PNG signature.\n"
266272
);
267273
}
268274

src/tests/purple.webp

66 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)