Skip to content

Commit

Permalink
Merge pull request #18 from alexwlchan/fix-bug
Browse files Browse the repository at this point in the history
Fix a bug when finding the dominant colour of some animated GIFs
  • Loading branch information
alexwlchan authored Oct 17, 2022
2 parents dc4e3c2 + 3a36605 commit 066d1be
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 62 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.1.3 - 2022-10-17

Fix a bug when finding the dominant colour of some animated GIFs.

## v1.1.2 - 2022-10-16

Add support for TIFF images.
Expand Down
122 changes: 61 additions & 61 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
@@ -1,6 +1,6 @@
[package]
name = "dominant_colours"
version = "1.1.2"
version = "1.1.3"
edition = "2018"

[dependencies]
Expand Down
15 changes: 15 additions & 0 deletions src/get_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,18 @@ pub fn get_bytes_for_gif(path: &str) -> Vec<u8> {
.flatten()
.collect()
}

#[cfg(test)]
mod test {
use crate::get_bytes;

// This image comes from https://stacks.wellcomecollection.org/peering-through-mri-scans-of-fruit-and-veg-part-1-a2e8b07bde6f
//
// I don't remember how I got these images, but for some reason they
// caused v1.1.2 to fall over. This is a test that they can still be
// processed correctly.
#[test]
fn it_gets_bytes_for_mri_fruit() {
get_bytes::get_bytes_for_gif("./src/tests/garlic.gif");
}
}
Binary file added src/tests/garlic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 066d1be

Please sign in to comment.