image: Move background color guess to other thread

Also, skip it completely for JPEG and BMP

Issue #111
This commit is contained in:
Sophie Herold 2023-04-03 17:39:02 +02:00 • committed by Christopher Davis
parent 114c292225
commit 1b18486826
2 changed files with 71 additions and 43 deletions

View file

@ -31,6 +31,13 @@ impl ImageFormat {
pub fn is_svg(&self) -> bool {
matches!(self, Self::Svg)
}
pub fn is_potentially_transparent(&self) -> bool {
!matches!(
self,
Self::ImageRs(image_rs::ImageFormat::Bmp) | Self::ImageRs(image_rs::ImageFormat::Jpeg)
)
}
}
impl std::fmt::Display for ImageFormat {