Browse Source

Corrected length of APP1 profile that is written inside the JPEG encoder (#454).

Former-commit-id: ea696cd10090a17d6afeb9d12b75c6f13740f1d5
Former-commit-id: c8fb6d3e38f358174751efb09de068743844de82
Former-commit-id: 0be10012c38c1290af56e1d80d363ba21e94f899
pull/1/head
dirk 10 years ago
parent
commit
21923086e5
  1. 6
      src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs

6
src/ImageProcessorCore/Formats/Jpg/JpegEncoderCore.cs

@ -595,10 +595,12 @@ namespace ImageProcessorCore.Formats
throw new ImageFormatException("Exif profile size exceeds limit.");
}
int length = data.Length + 2;
this.buffer[0] = JpegConstants.Markers.XFF;
this.buffer[1] = JpegConstants.Markers.APP1; // Application Marker
this.buffer[2] = (byte)((data.Length >> 8) & 0xFF);
this.buffer[3] = (byte)(data.Length & 0xFF);
this.buffer[2] = (byte)((length >> 8) & 0xFF);
this.buffer[3] = (byte)(length & 0xFF);
this.outputStream.Write(this.buffer, 0, 4);
this.outputStream.Write(data, 0, data.Length);

Loading…
Cancel
Save