@@ -10,7 +10,7 @@ use libs::image::codecs::avif::AvifEncoder;
10
10
use libs:: image:: codecs:: jpeg:: JpegEncoder ;
11
11
use libs:: image:: imageops:: FilterType ;
12
12
use libs:: image:: GenericImageView ;
13
- use libs:: image:: { EncodableLayout , ExtendedColorType , ImageEncoder , ImageFormat } ;
13
+ use libs:: image:: { EncodableLayout , ImageEncoder , ImageFormat } ;
14
14
use libs:: rayon:: prelude:: * ;
15
15
use libs:: { image, webp} ;
16
16
use serde:: { Deserialize , Serialize } ;
@@ -75,25 +75,12 @@ impl ImageOp {
75
75
}
76
76
Format :: Avif { quality, speed } => {
77
77
let mut avif: Vec < u8 > = Vec :: new ( ) ;
78
- let color_type = match img. color ( ) {
79
- image:: ColorType :: L8 => Ok ( ExtendedColorType :: L8 ) ,
80
- image:: ColorType :: La8 => Ok ( ExtendedColorType :: La8 ) ,
81
- image:: ColorType :: Rgb8 => Ok ( ExtendedColorType :: Rgb8 ) ,
82
- image:: ColorType :: Rgba8 => Ok ( ExtendedColorType :: Rgba8 ) ,
83
- image:: ColorType :: L16 => Ok ( ExtendedColorType :: L16 ) ,
84
- image:: ColorType :: La16 => Ok ( ExtendedColorType :: La16 ) ,
85
- image:: ColorType :: Rgb16 => Ok ( ExtendedColorType :: Rgb16 ) ,
86
- image:: ColorType :: Rgba16 => Ok ( ExtendedColorType :: Rgba16 ) ,
87
- image:: ColorType :: Rgb32F => Ok ( ExtendedColorType :: Rgb32F ) ,
88
- image:: ColorType :: Rgba32F => Ok ( ExtendedColorType :: Rgba32F ) ,
89
- c => Err ( anyhow ! ( "Unknown image color type '{:?}' for AVIF" , c) ) ,
90
- } ?;
91
78
let encoder = AvifEncoder :: new_with_speed_quality ( & mut avif, speed, quality) ;
92
79
encoder. write_image (
93
80
& img. as_bytes ( ) ,
94
81
img. dimensions ( ) . 0 ,
95
82
img. dimensions ( ) . 1 ,
96
- color_type ,
83
+ img . color ( ) . into ( ) ,
97
84
) ?;
98
85
buffered_f. write_all ( & avif. as_bytes ( ) ) ?;
99
86
}
0 commit comments