We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db70581 commit c7f18c8Copy full SHA for c7f18c8
src/ImageSharp/Color/Color.cs
@@ -3,6 +3,7 @@
3
4
using System.Numerics;
5
using System.Runtime.CompilerServices;
6
+using SixLabors.ImageSharp.Formats;
7
using SixLabors.ImageSharp.PixelFormats;
8
9
namespace SixLabors.ImageSharp;
@@ -124,7 +125,9 @@ public static Color FromPixel<TPixel>(TPixel pixel)
124
125
{
126
return new((L16)(object)pixel);
127
}
- else if (Unsafe.SizeOf<TPixel>() <= Unsafe.SizeOf<Rgba32>())
128
+
129
+ PixelTypeInfo info = TPixel.GetPixelTypeInfo();
130
+ if (info.ComponentPrecision <= PixelComponentPrecision.Byte)
131
132
Rgba32 p = default;
133
pixel.ToRgba32(ref p);
0 commit comments