-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1012 from equinox2k/PNGOptimisation
Added: ability to skip unneeded chunks for optimization mode
- Loading branch information
Showing
9 changed files
with
626 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Six Labors and contributors. | ||
// Licensed under the GNU Affero General Public License, Version 3. | ||
|
||
using System; | ||
|
||
namespace SixLabors.ImageSharp.Formats.Png | ||
{ | ||
/// <summary> | ||
/// Provides enumeration of available PNG optimization methods. | ||
/// </summary> | ||
[Flags] | ||
public enum PngChunkFilter | ||
{ | ||
/// <summary> | ||
/// With the None filter, all chunks will be written. | ||
/// </summary> | ||
None = 0, | ||
|
||
/// <summary> | ||
/// Excludes the physical dimension information chunk from encoding. | ||
/// </summary> | ||
ExcludePhysicalChunk = 1 << 0, | ||
|
||
/// <summary> | ||
/// Excludes the gamma information chunk from encoding. | ||
/// </summary> | ||
ExcludeGammaChunk = 1 << 1, | ||
|
||
/// <summary> | ||
/// Excludes the eXIf chunk from encoding. | ||
/// </summary> | ||
ExcludeExifChunk = 1 << 2, | ||
|
||
/// <summary> | ||
/// Excludes the tTXt, iTXt or zTXt chunk from encoding. | ||
/// </summary> | ||
ExcludeTextChunks = 1 << 3, | ||
|
||
/// <summary> | ||
/// All ancillary chunks will be excluded. | ||
/// </summary> | ||
ExcludeAll = ~None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) Six Labors and contributors. | ||
// Licensed under the GNU Affero General Public License, Version 3. | ||
|
||
namespace SixLabors.ImageSharp.Formats.Png | ||
{ | ||
/// <summary> | ||
/// Enum indicating how the transparency should be handled on encoding. | ||
/// </summary> | ||
public enum PngTransparentColorMode | ||
{ | ||
/// <summary> | ||
/// The transparency will be kept as is. | ||
/// </summary> | ||
Preserve = 0, | ||
|
||
/// <summary> | ||
/// Converts fully transparent pixels that may contain R, G, B values which are not 0, | ||
/// to transparent black, which can yield in better compression in some cases. | ||
/// </summary> | ||
Clear = 1, | ||
} | ||
} |
Oops, something went wrong.