diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
index bd1d84ecc9..8b5b7b151b 100644
--- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs
@@ -472,7 +472,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort
if (ProfileResolver.IsProfile(profile, ProfileResolver.ExifMarker))
{
this.isExif = true;
- this.MetaData.ExifProfile = new ExifProfile(profile);
+ if (this.MetaData.ExifProfile == null)
+ {
+ this.MetaData.ExifProfile = new ExifProfile(profile);
+ }
+ else
+ {
+ // if the exif information exceeds 64K, it will be split over multiple APP1 marker
+ this.MetaData.ExifProfile.Extend(profile);
+ }
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
index b38097060e..1f2695c5e6 100644
--- a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
+++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
@@ -18,7 +17,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
///
/// The byte array to read the EXIF profile from.
///
- private readonly byte[] data;
+ private byte[] data;
///
/// The collection of EXIF values
@@ -230,6 +229,19 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
this.values.Add(newExifValue);
}
+ ///
+ /// Extends the profile with additional data.
+ ///
+ /// The array containing addition profile data.
+ public void Extend(byte[] bytes)
+ {
+ int currentLength = this.data.Length;
+
+ // the first 6 bytes are Exif00 and will be skipped
+ Array.Resize(ref this.data, currentLength + bytes.Length - 6);
+ Buffer.BlockCopy(bytes, 6, this.data, currentLength, bytes.Length - 6);
+ }
+
///
/// Converts this instance to a byte array.
///