Skip to content

Commit d8e55e3

Browse files
committed
Add DecoderCommands.IgnoreColorProfileErrors
1 parent 8433f04 commit d8e55e3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Imageflow/Fluent/DecodeCommands.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class DecodeCommands
1919

2020
public bool DiscardColorProfile { get; set; } = false;
2121

22+
public bool IgnoreColorProfileErrors { get; set; } = false;
23+
2224
public DecodeCommands SetJpegDownscaling(int targetWidthHint,
2325
int targetHeightHint, DecoderDownscalingMode mode)
2426
{
@@ -39,6 +41,11 @@ public DecodeCommands SetDiscardColorProfile(bool value)
3941
DiscardColorProfile = value;
4042
return this;
4143
}
44+
public DecodeCommands SetIgnoreColorProfileErrors(bool value)
45+
{
46+
IgnoreColorProfileErrors = value;
47+
return this;
48+
}
4249

4350
public object[] ToImageflowDynamic()
4451
{
@@ -63,7 +70,8 @@ public object[] ToImageflowDynamic()
6370

6471

6572
object ignore = DiscardColorProfile ? new {discard_color_profile = (string) null} : null;
66-
return new [] {downscale, ignore, downscaleWebP}.Where(obj => obj != null).ToArray();
73+
object ignoreErrors = IgnoreColorProfileErrors ? new {ignore_color_profile_errors = (string) null} : null;
74+
return new [] {downscale, ignore, ignoreErrors, downscaleWebP}.Where(obj => obj != null).ToArray();
6775
}
6876
}
6977
}

src/Imageflow/Fluent/ImageJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ internal void AddOutput(int ioId, IOutputDestination destination)
4343
/// Decode an image into a frame
4444
/// </summary>
4545
/// <param name="source">Use BytesSource or StreamSource</param>
46-
/// <param name="commands">Commands to the decoder, such as JPEG or WebP block-wise downscaling for performance, or to discard the color profile</param>
46+
/// <param name="commands">Commands to the decoder, such as JPEG or WebP block-wise downscaling for performance, or to discard the color profile or ignore color profile errors</param>
4747
/// <returns></returns>
4848
public BuildNode Decode(IBytesSource source, DecodeCommands commands) =>
4949
Decode(source, GenerateIoId(), commands);

0 commit comments

Comments
 (0)