diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
index cf06cc1e02..20850cfc25 100644
--- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
@@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
this.WriteLogicalScreenDescriptor(image, stream, index);
// Write the first frame.
- this.WriteComments(image, stream);
+ this.WriteComments(image.MetaData, stream);
// Write additional frames.
if (image.Frames.Count > 1)
@@ -212,18 +212,16 @@ namespace SixLabors.ImageSharp.Formats.Gif
///
/// Writes the image comments to the stream.
///
- /// The pixel format.
- /// The to be encoded.
+ /// The metadata to be extract the comment data.
/// The stream to write to.
- private void WriteComments(Image image, Stream stream)
- where TPixel : struct, IPixel
+ private void WriteComments(ImageMetaData metadata, Stream stream)
{
if (this.ignoreMetadata)
{
return;
}
-
- ImageProperty property = image.MetaData.Properties.FirstOrDefault(p => p.Name == GifConstants.Comments);
+
+ ImageProperty property = metadata.Properties.FirstOrDefault(p => p.Name == GifConstants.Comments);
if (property == null || string.IsNullOrEmpty(property.Value))
{
return;