diff --git a/src/main.rs b/src/main.rs index 7d0b465..ec463a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -207,6 +207,24 @@ fn download(server: &str, args: DownloadArgs) -> Result<(), AviaryDownloadError> _ => AviaryDownloadError::FilesystemError(e, dest_dir.as_ref().to_owned()), })?; for (indx, image) in index.images.into_iter().enumerate() { + + // Print a little blurhash + const BH_WIDTH: u32 = 12; + const BH_HEIGHT: u32 = 5; + let blur = blurhash::decode(&image.blurhash, BH_WIDTH, BH_HEIGHT, 1.0); + let mut blur = blur.iter(); + for _ in 0..BH_HEIGHT { + for _ in 0..BH_WIDTH { + let r = blur.next().unwrap(); + let g = blur.next().unwrap(); + let b = blur.next().unwrap(); + let _ = blur.next().unwrap(); + print!("\x1b[38;2;{r};{g};{b}m█"); + } + print!("\n"); + } + print!("\x1b[0m"); + let extension = image.format.enum_value().map(|f| match f { Format::PNG => "png", Format::WEBP => "webp",