diff --git a/README.md b/README.md index 6a45862..a9a2eff 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,6 @@ some more practical uses would be things like: * add Bitsy HD and Bitsy 7.0 test data * fix variables/endings becoming "DLG DLG"? * dedupe "animation frames from string" functionality -* handle NaN in images (convert to 0? investigate) ### tidy up diff --git a/src/image.rs b/src/image.rs index 38d7edd..77bf829 100644 --- a/src/image.rs +++ b/src/image.rs @@ -7,6 +7,7 @@ impl From for Image { #[inline] fn from(string: String) -> Image { let string = string.replace("\n", ""); + let string = string.replace("NaN", "0"); let pixels: Vec<&str> = string.split("").collect(); // the above seems to add an extra "" at the start and end of the vec, so strip them below let pixels = &pixels[1..(pixels.len() - 1)];