Skip to content

Commit

Permalink
writing now explicitly a Bitamp v3 header (40 bytes)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpopow committed Dec 22, 2018
1 parent da6c23e commit 04f1a31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream)
}

var infoHeader = new BmpInfoHeader(
headerSize: BmpInfoHeader.Size,
headerSize: BmpInfoHeader.SizeV3,
height: image.Height,
width: image.Width,
bitsPerPixel: bpp,
Expand All @@ -105,7 +105,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream)
yPelsPerMeter: vResolution);

var fileHeader = new BmpFileHeader(
type: 19778, // BM
type: BmpConstants.TypeMarkers.Bitmap,
fileSize: 54 + infoHeader.ImageSize,
reserved: 0,
offset: 54);
Expand All @@ -119,7 +119,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream)

stream.Write(buffer, 0, BmpFileHeader.Size);

infoHeader.WriteTo(buffer);
infoHeader.WriteV3Header(buffer, BmpCompression.RGB);

stream.Write(buffer, 0, 40);

Expand Down

0 comments on commit 04f1a31

Please sign in to comment.