-
-
Notifications
You must be signed in to change notification settings - Fork 888
Added: ability to skip unneeded chunks for optimization mode #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
9d62a2c
69f01c3
9ee2066
8d9fbb7
81bc719
fc8f5e3
ba08c64
f8c5277
6e3e4ce
6259881
d68d7bd
6765f96
f257ef2
f04e836
624591c
a86713f
8ca9b97
c386f9d
200ef9f
f9c2f6a
0f581ab
bc7eb27
ec3656f
749f68a
129b639
b69d772
b817615
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) Six Labors and contributors. | ||
| // Licensed under the Apache License, Version 2.0. | ||
|
|
||
| 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 possible optimizations. | ||
| /// </summary> | ||
| ExcludeAll = ExcludePhysicalChunk | ExcludeGammaChunk | ExcludeExifChunk | ExcludeTextChunks | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,16 @@ public sealed class PngEncoder : IImageEncoder, IPngEncoderOptions | |
| /// <inheritdoc/> | ||
| public PngInterlaceMode? InterlaceMethod { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the chunk filter. This can be used to exclude some ancillary chunks from being written. | ||
| /// </summary> | ||
| public PngChunkFilter? ChunkFilter { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a value indicating whether fully transparent pixels should be converted to black pixels. | ||
| /// </summary> | ||
| public bool MakeTransparentBlack { get; set; } | ||
|
||
|
|
||
| /// <summary> | ||
| /// Encodes the image to the specified stream from the <see cref="Image{TPixel}"/>. | ||
| /// </summary> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.