@@ -112,12 +112,12 @@ public ImageInfo Identify(
112112 this . webpMetadata = this . metadata . GetWebpMetadata ( ) ;
113113 this . webpMetadata . RepeatCount = features . AnimationLoopCount ;
114114
115- Color backgroundColor = this . backgroundColorHandling == BackgroundColorHandling . Ignore
115+ this . webpMetadata . BackgroundColor = this . backgroundColorHandling == BackgroundColorHandling . Ignore
116116 ? Color . Transparent
117117 : features . AnimationBackgroundColor ! . Value ;
118118
119- this . webpMetadata . BackgroundColor = backgroundColor ;
120-
119+ bool ignoreMetadata = this . skipMetadata ;
120+ SegmentIntegrityHandling segmentIntegrityHandling = this . segmentIntegrityHandling ;
121121 Span < byte > buffer = stackalloc byte [ 4 ] ;
122122 uint frameCount = 0 ;
123123 int remainingBytes = ( int ) completeDataSize ;
@@ -135,9 +135,16 @@ public ImageInfo Identify(
135135
136136 remainingBytes -= ( int ) dataSize ;
137137 break ;
138+ case WebpChunkType . Iccp :
138139 case WebpChunkType . Xmp :
139140 case WebpChunkType . Exif :
140- WebpChunkParsingUtils . ParseOptionalChunks ( stream , chunkType , this . metadata , this . skipMetadata , this . segmentIntegrityHandling , buffer ) ;
141+ WebpChunkParsingUtils . ParseOptionalChunks (
142+ stream ,
143+ chunkType ,
144+ this . metadata ,
145+ ignoreMetadata ,
146+ segmentIntegrityHandling ,
147+ buffer ) ;
141148 break ;
142149 default :
143150
@@ -187,9 +194,12 @@ public Image<TPixel> Decode<TPixel>(
187194 this . webpMetadata . BackgroundColor = backgroundColor ;
188195 TPixel backgroundPixel = backgroundColor . ToPixel < TPixel > ( ) ;
189196
197+ bool ignoreMetadata = this . skipMetadata ;
198+ SegmentIntegrityHandling segmentIntegrityHandling = this . segmentIntegrityHandling ;
190199 Span < byte > buffer = stackalloc byte [ 4 ] ;
191200 uint frameCount = 0 ;
192201 int remainingBytes = ( int ) completeDataSize ;
202+
193203 while ( remainingBytes > 0 )
194204 {
195205 WebpChunkType chunkType = WebpChunkParsingUtils . ReadChunkType ( stream , buffer ) ;
@@ -209,9 +219,10 @@ public Image<TPixel> Decode<TPixel>(
209219
210220 remainingBytes -= ( int ) dataSize ;
211221 break ;
222+ case WebpChunkType . Iccp :
212223 case WebpChunkType . Xmp :
213224 case WebpChunkType . Exif :
214- WebpChunkParsingUtils . ParseOptionalChunks ( stream , chunkType , image ! . Metadata , this . skipMetadata , this . segmentIntegrityHandling , buffer ) ;
225+ WebpChunkParsingUtils . ParseOptionalChunks ( stream , chunkType , image ! . Metadata , ignoreMetadata , segmentIntegrityHandling , buffer ) ;
215226 break ;
216227 default :
217228
0 commit comments