diff --git a/tests/Magick.NET.Tests/Coders/TheJpegCoder.cs b/tests/Magick.NET.Tests/Coders/TheJpegCoder.cs index c75c6f4111..588399e85a 100644 --- a/tests/Magick.NET.Tests/Coders/TheJpegCoder.cs +++ b/tests/Magick.NET.Tests/Coders/TheJpegCoder.cs @@ -1,6 +1,7 @@ // Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. // Licensed under the Apache License, Version 2.0. +using System; using System.IO; using ImageMagick; using Xunit; @@ -57,4 +58,26 @@ public void ShouldWriteTheXmpProfileToTheImage() Assert.NotNull(result); Assert.True(result.Equals(profile)); } + + [Fact] + public void ShouldSupportWritingExifProfileWithMaxLength() + { + using var input = new MagickImage(Files.FujiFilmFinePixS1ProJPG); + + var profile = input.GetExifProfile(); + Assert.NotNull(profile); + + var data = profile.ToByteArray(); + Assert.NotNull(data); + + Array.Resize(ref data, 65533); + input.SetProfile(new ImageProfile("exif", data)); + + data = input.ToByteArray(MagickFormat.Jpeg); + + using var output = new MagickImage(data); + + profile = output.GetExifProfile(); + Assert.NotNull(profile); + } }