Skip to content
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

Why CannelCount=2, but Cannels.Count=1 when load a gray jpg ? #1496

Closed
Charltsing opened this issue Dec 25, 2023 · 1 comment
Closed

Why CannelCount=2, but Cannels.Count=1 when load a gray jpg ? #1496

Charltsing opened this issue Dec 25, 2023 · 1 comment

Comments

@Charltsing
Copy link

Charltsing commented Dec 25, 2023

Magick.NET version

13.3.3

Environment (Operating system, version and so on)

Windows10, net framework 4.7.2

Description

CannelCount=2, but Cannels.Count=1 when load a gray jpg ?

1

it is jpg image
img.zip

Steps to Reproduce

byte[] picbyte = File.ReadAllBytes(fullpath);
using (MagickImage magickimage = new MagickImage(picbyte, settings))

settings as follow :

var settings = new MagickReadSettings
{
// #1077
SyncImageWithExifProfile = true,
SyncImageWithTiffProperties = true,
};
if (extname.Equals(".SVG", StringComparison.OrdinalIgnoreCase))
{
settings.BackgroundColor = MagickColors.Transparent;
settings.SetDefine("svg:xml-parse-huge", "true");
}
else if (extname.Equals(".HEIC", StringComparison.OrdinalIgnoreCase) ||
extname.Equals(".HEIF", StringComparison.OrdinalIgnoreCase))
{
settings.SetDefines(new HeicReadDefines
{
PreserveOrientation = true,
DepthImage = true,
});
}
else if (extname.Equals(".JP2", StringComparison.OrdinalIgnoreCase))
{
settings.SetDefines(new Jp2ReadDefines
{
QualityLayers = 100,
});
}
else if (extname.Equals(".TIF", StringComparison.OrdinalIgnoreCase) ||
extname.Equals(".TIFF", StringComparison.OrdinalIgnoreCase))
{
settings.SetDefines(new TiffReadDefines
{
IgnoreTags = new[] {
// Issue d2phap/ImageGlass#1454
"34022", // ColorTable
"34025", // ImageColorValue
"34026", // BackgroundColorValue

// Issue https://github.com/d2phap/ImageGlass/issues/1181
"32928",

// Issue https://github.com/d2phap/ImageGlass/issues/1583
"32932", // Wang Annotation
// Issue https://github.com/d2phap/ImageGlass/issues/1617
"34031", // TrapIndicator

},
});
}

// Fixed #708: length and filesize do not match
settings.SetDefines(new BmpReadDefines
{
IgnoreFileSize = true,
});

// Fix RAW color
settings.SetDefines(new DngReadDefines()
{
UseCameraWhitebalance = true,
OutputColor = DngOutputColor.SRGB,
ReadThumbnail = true,
});

@Charltsing Charltsing changed the title CannelCount=2, but Cannels.Count=1 when load a gray jpg ? Why CannelCount=2, but Cannels.Count=1 when load a gray jpg ? Dec 25, 2023
@dlemstra
Copy link
Owner

That is happening because ChannelCount includes the index channel but the Channels property doesn't. I don't know why I did that but I just pushed a patch to also include the Index channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants