-
-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AssumeAlpha to the Jp2ReadDefines that allows a user to assume …
…a 2nd or 4th channel is an alpha channel (#1449).
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
tests/Magick.NET.Tests/Formats/Jp2/Jp2ReadDefinesTests/TheAssumeAlphaProperty.cs
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,34 @@ | ||
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using ImageMagick; | ||
using ImageMagick.Formats; | ||
using Xunit; | ||
|
||
namespace Magick.NET.Tests; | ||
|
||
public partial class Jp2ReadDefinesTests | ||
{ | ||
public class TheAssumeAlphaProperty | ||
{ | ||
[Fact] | ||
public void ShouldTreatMetaChannelAsAlpha() | ||
{ | ||
var settings = new MagickReadSettings | ||
{ | ||
Defines = new Jp2ReadDefines | ||
{ | ||
AssumeAlpha = true, | ||
}, | ||
}; | ||
|
||
using var image = new MagickImage(); | ||
image.Read(Files.Coders.TestJP2, settings); | ||
|
||
Assert.Equal("true", image.Settings.GetDefine(MagickFormat.Jp2, "assume-alpha")); | ||
Assert.True(image.HasAlpha); | ||
Assert.Equal(4, image.ChannelCount); | ||
Assert.Contains(PixelChannel.Alpha, image.Channels); | ||
} | ||
} | ||
} |
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