@@ -182,6 +182,58 @@ public void Encode_8BitGray_WithV4Header_Works<TPixel>(TestImageProvider<TPixel>
182182 bitsPerPixel ,
183183 supportTransparency : true ) ;
184184
185+ [ Theory ]
186+ [ WithFile ( Bit32Rgb , PixelTypes . Rgba32 ) ]
187+ public void Encode_8BitColor_WithWuQuantizer < TPixel > ( TestImageProvider < TPixel > provider )
188+ where TPixel : struct , IPixel < TPixel >
189+ {
190+ if ( ! TestEnvironment . Is64BitProcess )
191+ {
192+ return ;
193+ }
194+
195+ using ( Image < TPixel > image = provider . GetImage ( ) )
196+ {
197+ var encoder = new BmpEncoder
198+ {
199+ BitsPerPixel = BmpBitsPerPixel . Pixel8 ,
200+ Quantizer = new WuQuantizer ( 256 )
201+ } ;
202+ string actualOutputFile = provider . Utility . SaveTestOutputFile ( image , "bmp" , encoder , appendPixelTypeToFileName : false ) ;
203+ IImageDecoder referenceDecoder = TestEnvironment . GetReferenceDecoder ( actualOutputFile ) ;
204+ using ( var referenceImage = Image . Load < TPixel > ( actualOutputFile , referenceDecoder ) )
205+ {
206+ referenceImage . CompareToReferenceOutput ( ImageComparer . TolerantPercentage ( 0.01f ) , provider , extension : "bmp" , appendPixelTypeToFileName : false ) ;
207+ }
208+ }
209+ }
210+
211+ [ Theory ]
212+ [ WithFile ( Bit32Rgb , PixelTypes . Rgba32 ) ]
213+ public void Encode_8BitColor_WithOctreeQuantizer < TPixel > ( TestImageProvider < TPixel > provider )
214+ where TPixel : struct , IPixel < TPixel >
215+ {
216+ if ( ! TestEnvironment . Is64BitProcess )
217+ {
218+ return ;
219+ }
220+
221+ using ( Image < TPixel > image = provider . GetImage ( ) )
222+ {
223+ var encoder = new BmpEncoder
224+ {
225+ BitsPerPixel = BmpBitsPerPixel . Pixel8 ,
226+ Quantizer = new OctreeQuantizer ( 256 )
227+ } ;
228+ string actualOutputFile = provider . Utility . SaveTestOutputFile ( image , "bmp" , encoder , appendPixelTypeToFileName : false ) ;
229+ IImageDecoder referenceDecoder = TestEnvironment . GetReferenceDecoder ( actualOutputFile ) ;
230+ using ( var referenceImage = Image . Load < TPixel > ( actualOutputFile , referenceDecoder ) )
231+ {
232+ referenceImage . CompareToReferenceOutput ( ImageComparer . TolerantPercentage ( 0.01f ) , provider , extension : "bmp" , appendPixelTypeToFileName : false ) ;
233+ }
234+ }
235+ }
236+
185237 [ Theory ]
186238 [ WithFile ( TestImages . Png . GrayAlpha2BitInterlaced , PixelTypes . Rgba32 , BmpBitsPerPixel . Pixel32 ) ]
187239 [ WithFile ( Bit32Rgba , PixelTypes . Rgba32 , BmpBitsPerPixel . Pixel32 ) ]
0 commit comments