@@ -185,7 +185,7 @@ public PngEncoderCore(MemoryAllocator memoryAllocator, IPngEncoderOptions option
185185 this . pngColorType = options . ColorType ;
186186
187187 // Specification recommends default filter method None for paletted images and Paeth for others.
188- this . pngFilterMethod = options . FilterMethod ?? ( options . ColorType . Equals ( PngColorType . Palette )
188+ this . pngFilterMethod = options . FilterMethod ?? ( options . ColorType == PngColorType . Palette
189189 ? PngFilterMethod . None
190190 : PngFilterMethod . Paeth ) ;
191191 this . compressionLevel = options . CompressionLevel ;
@@ -217,7 +217,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream)
217217 this . writeGamma = this . gamma > 0 ;
218218 this . pngColorType = this . pngColorType ?? pngMetaData . ColorType ;
219219 this . pngBitDepth = this . pngBitDepth ?? pngMetaData . BitDepth ;
220- this . use16Bit = this . pngBitDepth . Equals ( PngBitDepth . Bit16 ) ;
220+ this . use16Bit = this . pngBitDepth == PngBitDepth . Bit16 ;
221221
222222 // Ensure we are not allowing impossible combinations.
223223 if ( ! ColorTypes . ContainsKey ( this . pngColorType . Value ) )
@@ -329,7 +329,7 @@ private void CollectGrayscaleBytes<TPixel>(ReadOnlySpan<TPixel> rowSpan)
329329 Span < byte > rawScanlineSpan = this . rawScanline . GetSpan ( ) ;
330330 ref byte rawScanlineSpanRef = ref MemoryMarshal . GetReference ( rawScanlineSpan ) ;
331331
332- if ( this . pngColorType . Equals ( PngColorType . Grayscale ) )
332+ if ( this . pngColorType == PngColorType . Grayscale )
333333 {
334334 if ( this . use16Bit )
335335 {
@@ -761,7 +761,7 @@ private void WriteGammaChunk(Stream stream)
761761 private void WriteTransparencyChunk ( Stream stream , PngMetaData pngMetaData )
762762 {
763763 Span < byte > alpha = this . chunkDataBuffer . AsSpan ( ) ;
764- if ( pngMetaData . ColorType . Equals ( PngColorType . Rgb ) )
764+ if ( pngMetaData . ColorType == PngColorType . Rgb )
765765 {
766766 if ( pngMetaData . TransparentRgb48 . HasValue && this . use16Bit )
767767 {
@@ -782,7 +782,7 @@ private void WriteTransparencyChunk(Stream stream, PngMetaData pngMetaData)
782782 this . WriteChunk ( stream , PngChunkType . Transparency , this . chunkDataBuffer , 0 , 6 ) ;
783783 }
784784 }
785- else if ( pngMetaData . ColorType . Equals ( PngColorType . Grayscale ) )
785+ else if ( pngMetaData . ColorType == PngColorType . Grayscale )
786786 {
787787 if ( pngMetaData . TransparentGray16 . HasValue && this . use16Bit )
788788 {
0 commit comments