File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
src/Magick.NET/Formats/Tiff
tests/Magick.NET.Tests/Formats/Tiff/TiffReadDefinesTests Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ namespace ImageMagick.Formats;
11
11
/// </summary>
12
12
public sealed class TiffReadDefines : IReadDefines
13
13
{
14
+ /// <summary>
15
+ /// Gets or sets a value indicating whether to assume that a single extra sample is an alpha channel (tiff:assume-alpha).
16
+ /// </summary>
17
+ public bool ? AssumeAlpha { get ; set ; }
18
+
14
19
/// <summary>
15
20
/// Gets the format where the defines are for.
16
21
/// </summary>
@@ -49,6 +54,9 @@ public IEnumerable<IDefine> Defines
49
54
{
50
55
get
51
56
{
57
+ if ( AssumeAlpha is not null )
58
+ yield return new MagickDefine ( Format , "assume-alpha" , AssumeAlpha . Value ) ;
59
+
52
60
if ( IgnoreExifProperties . Equals ( true ) )
53
61
yield return new MagickDefine ( Format , "exif-properties" , false ) ;
54
62
Original file line number Diff line number Diff line change
1
+ // Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
2
+ // Licensed under the Apache License, Version 2.0.
3
+
4
+ using ImageMagick ;
5
+ using ImageMagick . Formats ;
6
+ using Xunit ;
7
+
8
+ namespace Magick . NET . Tests ;
9
+
10
+ public partial class TiffReadDefinesTests
11
+ {
12
+ public class TheAssumeAlphaProperty
13
+ {
14
+ [ Fact ]
15
+ public void ShouldSetTheDefine ( )
16
+ {
17
+ using var image = new MagickImage ( ) ;
18
+ image . Settings . SetDefines ( new TiffReadDefines
19
+ {
20
+ AssumeAlpha = true ,
21
+ } ) ;
22
+
23
+ Assert . Equal ( "true" , image . Settings . GetDefine ( MagickFormat . Tiff , "assume-alpha" ) ) ;
24
+ }
25
+ }
26
+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ public void ShouldNotSetAnyDefine()
17
17
using var image = new MagickImage ( ) ;
18
18
image . Settings . SetDefines ( new TiffReadDefines ( ) ) ;
19
19
20
+ Assert . Null ( image . Settings . GetDefine ( MagickFormat . Tiff , "assume-alpha" ) ) ;
20
21
Assert . Null ( image . Settings . GetDefine ( MagickFormat . Tiff , "exif-properties" ) ) ;
21
22
Assert . Null ( image . Settings . GetDefine ( MagickFormat . Tiff , "ignore-layers" ) ) ;
22
23
Assert . Null ( image . Settings . GetDefine ( MagickFormat . Tiff , "ignore-tags" ) ) ;
You can’t perform that action at this time.
0 commit comments