File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,6 +370,30 @@ public void Encode_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixe
370370 TestBmpEncoderCore ( provider , bitsPerPixel ) ;
371371 }
372372
373+ [ Theory ]
374+ [ WithFile ( BlackWhitePalletDataMatrix , PixelTypes . Rgb24 , BmpBitsPerPixel . Pixel1 ) ]
375+ public void Encode_Issue2467 < TPixel > ( TestImageProvider < TPixel > provider , BmpBitsPerPixel bitsPerPixel )
376+ where TPixel : unmanaged, IPixel < TPixel >
377+ {
378+ using Image < TPixel > image = provider . GetImage ( ) ;
379+
380+ using var reencodedStream = new MemoryStream ( ) ;
381+ var encoder = new BmpEncoder
382+ {
383+ BitsPerPixel = bitsPerPixel ,
384+ SupportTransparency = false ,
385+ Quantizer = KnownQuantizers . Octree
386+ } ;
387+ image . SaveAsBmp ( reencodedStream , encoder ) ;
388+ reencodedStream . Seek ( 0 , SeekOrigin . Begin ) ;
389+
390+ using Image < TPixel > reencodedImage = Image . Load < TPixel > ( reencodedStream ) ;
391+
392+ reencodedImage . DebugSave ( provider ) ;
393+
394+ reencodedImage . CompareToOriginal ( provider ) ;
395+ }
396+
373397 private static void TestBmpEncoderCore < TPixel > (
374398 TestImageProvider < TPixel > provider ,
375399 BmpBitsPerPixel bitsPerPixel ,
Original file line number Diff line number Diff line change @@ -407,6 +407,8 @@ public static class Bmp
407407 public const string Rgba321010102 = "Bmp/rgba32-1010102.bmp" ;
408408 public const string RgbaAlphaBitfields = "Bmp/rgba32abf.bmp" ;
409409
410+ public const string BlackWhitePalletDataMatrix = "Bmp/bit1datamatrix.bmp" ;
411+
410412 public static readonly string [ ] BitFields =
411413 {
412414 Rgb32bfdef ,
Original file line number Diff line number Diff line change 1+ version https://git-lfs.github.com/spec/v1
2+ oid sha256:3b2288e2a059b15c7855eb141c05e3ce69431e7c3ddef851033f7fd9ca39a2d4
3+ size 102
You can’t perform that action at this time.
0 commit comments