Remove System.Drawing.Common dependency
This commit is contained in:
parent
bd0644e775
commit
022a559bc7
3 changed files with 4 additions and 7 deletions
|
|
@ -161,9 +161,9 @@ public class ImageServiceTests
|
|||
|
||||
private static void GenerateColorImage(string hexColor, string outputPath)
|
||||
{
|
||||
var color = ImageService.HexToRgb(hexColor);
|
||||
var (r, g, b) = ImageService.HexToRgb(hexColor);
|
||||
using var blackImage = Image.Black(200, 100);
|
||||
using var colorImage = blackImage.NewFromImage(color.R, color.G, color.B);
|
||||
using var colorImage = blackImage.NewFromImage(r, g, b);
|
||||
colorImage.WriteToFile(outputPath);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.8.0" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="22.0.13" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.4" />
|
||||
<PackageReference Include="VersOne.Epub" Version="3.3.3" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@ using API.Entities.Interfaces;
|
|||
using API.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NetVips;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors.Quantization;
|
||||
using Color = System.Drawing.Color;
|
||||
using Image = NetVips.Image;
|
||||
|
||||
namespace API.Services;
|
||||
|
|
@ -750,7 +748,7 @@ public class ImageService : IImageService
|
|||
}
|
||||
|
||||
|
||||
public static Color HexToRgb(string? hex)
|
||||
public static (int R, int G, int B) HexToRgb(string? hex)
|
||||
{
|
||||
if (string.IsNullOrEmpty(hex)) throw new ArgumentException("Hex cannot be null");
|
||||
|
||||
|
|
@ -774,7 +772,7 @@ public class ImageService : IImageService
|
|||
var g = Convert.ToInt32(hex.Substring(2, 2), 16);
|
||||
var b = Convert.ToInt32(hex.Substring(4, 2), 16);
|
||||
|
||||
return Color.FromArgb(r, g, b);
|
||||
return (r, g, b);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue