Add function to get the size of a thumbnail

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 001affa3fb
commit 5017e26991
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -4,7 +4,7 @@ readme = "README.md"
license = "Apache-2.0" license = "Apache-2.0"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
description = "An image thumbnail creation library" description = "An image thumbnail creation library"
version = "0.2.4" version = "0.2.5"
edition = "2018" edition = "2018"
repository = "https://github.com/Trivernis/thumbnailer" repository = "https://github.com/Trivernis/thumbnailer"

@ -22,7 +22,7 @@
use crate::error::ThumbResult; use crate::error::ThumbResult;
use image; use image;
use image::imageops::FilterType; use image::imageops::FilterType;
use image::{DynamicImage, ImageOutputFormat}; use image::{DynamicImage, GenericImageView, ImageOutputFormat};
use mime::Mime; use mime::Mime;
use rayon::prelude::*; use rayon::prelude::*;
use std::io::{BufRead, Seek, Write}; use std::io::{BufRead, Seek, Write};
@ -55,6 +55,11 @@ impl Thumbnail {
Ok(()) Ok(())
} }
/// Returns the size of the thumbnail as width, height
pub fn size(&self) -> (u32, u32) {
self.inner.dimensions()
}
} }
/// Creates thumbnails of the requested sizes for the given reader providing the content as bytes and /// Creates thumbnails of the requested sizes for the given reader providing the content as bytes and

Loading…
Cancel
Save