diff --git a/src/ImageSharp/Formats/Png/PngChunkType.cs b/src/ImageSharp/Formats/Png/PngChunkType.cs
index f2dae5c67d..e26e7e1e8b 100644
--- a/src/ImageSharp/Formats/Png/PngChunkType.cs
+++ b/src/ImageSharp/Formats/Png/PngChunkType.cs
@@ -4,17 +4,57 @@
namespace SixLabors.ImageSharp.Formats.Png
{
///
- /// Contains a list of possible chunk types.
+ /// Contains a list of of chunk types.
///
internal enum PngChunkType : uint
{
+ ///
+ /// The first chunk in a png file. Can only exists once. Contains
+ /// common information like the width and the height of the image or
+ /// the used compression method.
+ ///
Header = 1229472850U, // IHDR
+
+ ///
+ /// The PLTE chunk contains from 1 to 256 palette entries, each a three byte
+ /// series in the RGB format.
+ ///
Palette = 1347179589U, // PLTE
+
+ ///
+ /// The IDAT chunk contains the actual image data. The image can contains more
+ /// than one chunk of this type. All chunks together are the whole image.
+ ///
Data = 1229209940U, // IDAT
+
+ ///
+ /// This chunk must appear last. It marks the end of the PNG data stream.
+ /// The chunk's data field is empty.
+ ///
End = 1229278788U, // IEND
+
+ ///
+ /// This chunk specifies that the image uses simple transparency:
+ /// either alpha values associated with palette entries (for indexed-color images)
+ /// or a single transparent color (for grayscale and true color images).
+ ///
PaletteAlpha = 1951551059U, // tRNS
+
+ ///
+ /// Textual information that the encoder wishes to record with the image can be stored in
+ /// tEXt chunks. Each tEXt chunk contains a keyword and a text string.
+ ///
Text = 1950701684U, // tEXt
+
+ ///
+ /// This chunk specifies the relationship between the image samples and the desired
+ /// display output intensity.
+ ///
Gamma = 1732332865U, // gAMA
+
+ ///
+ /// The pHYs chunk specifies the intended pixel size or aspect ratio for display of the image.
+ ///
Physical = 1883789683U, // pHYs
}
}
diff --git a/src/ImageSharp/Formats/Png/PngChunkTypeNames.cs b/src/ImageSharp/Formats/Png/PngChunkTypeNames.cs
deleted file mode 100644
index f2864decd6..0000000000
--- a/src/ImageSharp/Formats/Png/PngChunkTypeNames.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-namespace SixLabors.ImageSharp.Formats.Png
-{
- ///
- /// Contains a list of possible chunk type identifier names.
- ///
- internal static class PngChunkTypeNames
- {
- ///
- /// The first chunk in a png file. Can only exists once. Contains
- /// common information like the width and the height of the image or
- /// the used compression method.
- ///
- public const string Header = "IHDR";
-
- ///
- /// The PLTE chunk contains from 1 to 256 palette entries, each a three byte
- /// series in the RGB format.
- ///
- public const string Palette = "PLTE";
-
- ///
- /// The IDAT chunk contains the actual image data. The image can contains more
- /// than one chunk of this type. All chunks together are the whole image.
- ///
- public const string Data = "IDAT";
-
- ///
- /// This chunk must appear last. It marks the end of the PNG data stream.
- /// The chunk's data field is empty.
- ///
- public const string End = "IEND";
-
- ///
- /// This chunk specifies that the image uses simple transparency:
- /// either alpha values associated with palette entries (for indexed-color images)
- /// or a single transparent color (for grayscale and true color images).
- ///
- public const string PaletteAlpha = "tRNS";
-
- ///
- /// Textual information that the encoder wishes to record with the image can be stored in
- /// tEXt chunks. Each tEXt chunk contains a keyword and a text string.
- ///
- public const string Text = "tEXt";
-
- ///
- /// This chunk specifies the relationship between the image samples and the desired
- /// display output intensity.
- ///
- public const string Gamma = "gAMA";
-
- ///
- /// The pHYs chunk specifies the intended pixel size or aspect ratio for display of the image.
- ///
- public const string Physical = "pHYs";
- }
-}
diff --git a/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngChunkTypeTests.cs
similarity index 96%
rename from tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs
rename to tests/ImageSharp.Tests/Formats/Png/PngChunkTypeTests.cs
index 687548963b..016c932dd1 100644
--- a/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Png/PngChunkTypeTests.cs
@@ -6,7 +6,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Png
{
- public class PngChunkTests
+ public class PngChunkTypeTests
{
[Fact]
public void ChunkTypeIdsAreCorrect()
diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
index 85430fea9c..7adfa3a3ad 100644
--- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
@@ -242,10 +242,10 @@ namespace SixLabors.ImageSharp.Tests
}
[Theory]
- [InlineData(PngChunkTypeNames.Header)]
- [InlineData(PngChunkTypeNames.Palette)]
+ [InlineData("IHDR")] // Header
+ [InlineData("PLTE")] // Palette
// [InlineData(PngChunkTypes.Data)] //TODO: Figure out how to test this
- [InlineData(PngChunkTypeNames.End)]
+ [InlineData("IEND")] // End
public void Decode_IncorrectCRCForCriticalChunk_ExceptionIsThrown(string chunkName)
{
using (var memStream = new MemoryStream())
@@ -266,9 +266,9 @@ namespace SixLabors.ImageSharp.Tests
}
[Theory]
- [InlineData(PngChunkTypeNames.Gamma)]
- [InlineData(PngChunkTypeNames.PaletteAlpha)]
- [InlineData(PngChunkTypeNames.Physical)] // It's ok to test physical as we don't throw for duplicate chunks.
+ [InlineData("gAMA")] // Gamma
+ [InlineData("tRNS")] // PaletteAlpha
+ [InlineData("pHYs")] // Pysical: It's ok to test physical as we don't throw for duplicate chunks.
//[InlineData(PngChunkTypes.Text)] //TODO: Figure out how to test this
public void Decode_IncorrectCRCForNonCriticalChunk_ExceptionIsThrown(string chunkName)
{