.NET에서 System.Drawing.Common을 대체하는 C# 비트맵 라이브러리

Curtis Chau
Curtis Chau
업데이트됨: 2026년 8월 2일

IronDrawing은 무료 오픈 소스 소프트웨어이며 대부분의 .NET 드로잉 라이브러리 형식을 지원합니다.

IronDrawing은 Iron Software가 원래 개발한 오픈 소스 라이브러리로, Windows, macOS, Linux 플랫폼의 .NET 프로젝트에서 C# 소프트웨어 엔지니어가 System.Drawing.Common를 대체하는 데 도움을 줍니다.

.NET 5, 6, 7 및 8용 그래픽, 이미지 및 글꼴을 지원하는 클래스 라이브러리와 NuGet 패키지를 개발하는 것은 쉬워야 합니다.

IronDrawing은 새롭게 제안된 .NET 5, 6, 7 및 8 그래픽 표준이 발전함에 따라 이 모든 표준 간의 원활한 연결 고리 역할을 하므로 원하는 표준 에 대해서만 개발하면 됩니다.

IronDrawing은 무료 오픈 소스 소프트웨어이며 대부분의 .NET 드로잉 라이브러리 형식을 지원합니다.

문맥

Microsoft .NET 은 전 세계 수백만 명의 소프트웨어 개발자가 사용하는 다중 플랫폼 호환성이 뛰어난 소프트웨어 프레임워크입니다. Microsoft는 System.Drawing.Common가 Windows 플랫폼에서만 지원되는 중대한 변경 사항을 발표했습니다.

Microsoft의 권장 조치에 따라 라이브러리를 다시 빌드하여 비 Windows 사용자를 지원해야 하기 때문에, System.Drawing.Common를 사용하는 크로스 플랫폼 라이브러리를 유지하는 .NET 라이브러리 개발자에게 이는 문제가 됩니다. 자원봉사자와 학자들은 새롭게 제안된 그래픽 라이브러리가 등장할 때마다 이를 사용하기 위해 모든 NuGet 패키지와 클래스 라이브러리를 재구축해야 하므로 기술적 부채가 발생하여 최신 .NET 의 도입이 늦어질 것입니다.

궁극적으로 우리는 .NET 사용할 때 NuGet 사용합니다.

NuGet 패키지 개발자들은 .NET 발전시키고 미리 패키지화된 코드를 제공함으로써 우리 모두에게 큰 도움을 주고 있습니다. 우리가 직접 코드를 작성하려면 매일 수천 시간이 걸릴 것입니다.

이번 호환성 파괴 변경으로 인해 NuGet 개발 속도가 느려지고 .NET 개발자가 의존하는 코드 라이브러리가 버려지거나 더 이상 사용되지 않게 될 수 있습니다. 지금 당장 행동해야 합니다!

우리의 솔루션

기존 그래픽 라이브러리와 새로운 그래픽 라이브러리 간의 변환을 위한 중간 그래픽 형식입니다.

클래스 라이브러리 개발자로서, 공용 Bitmap, Color, Rectangle, Font 및 Size 입력 및 출력은 모든 새로운 표준을 지원하는 한 가지 형식만 사용할 수 있습니다. 내부적으로는 당신이 좋아하는 일을 계속할 수 있습니다.

IronDrawing은 .NET Framework 4.62와 하위 호환되며, 모든 버전의 .NET ( .NET 8 포함)을 지원합니다.

IronDrawing의 개발 및 출시로 Bitmap, Color, Rectangle, Font, Size와 같은 중요한 클래스를 위한 통일된 형식의 부족 문제를 해결하는 오픈 소스 솔루션이 제공됩니다. IronSoftware.Drawing는 여러분을 위해 System.Drawing, Microsoft.Maui, SkiaSharp, SixLabors의 이러한 유형 구현 간을 매끄럽게 변환합니다. 이렇게 하면 개발자는 라이브러리 내의 이러한 클래스의 모든 인스턴스를 교체할 필요가 없습니다.

예를 들어, System.Drawing.Bitmap를 사용하는 경우, IronDrawing의 AnyBitmap 클래스는 System.Drawing.Bitmap, System.Drawing.Image, SkiaSharp.SKBitmap, SkiaSharp.SKImage, SixLabors.ImageSharp, Microsoft.Maui.Graphics.Platform.PlatformImage와 같은 유형으로의 암시적 변환을 제공합니다.

우리는 왜 이걸 무료로 하는 걸까요?

Iron Software .NET 의 발전에 관심을 갖고 있으며, .NET이 성장하고 성공하기를 바라는 오랜 경력의 시니어 .NET 개발자들이 모인 회사이기 때문에 IronDrawing을 개발했습니다. .NET 7에서 볼 수 있듯이 .NET 이 성장하고 발전하는 모습을 보니 정말 기쁩니다. 저희는 NuGet 매일 사용하고 있으며, 여러분도 마찬가지일 거라고 생각합니다. 우리는 System.Drawing에서 벗어나 미래로의 손쉬운 전환을 지지하고 장려하고자 합니다.

저희는 모든 .NET 클래스 라이브러리 및 NuGet 개발이 더 쉬워지기를 바라며, 이를 통해 NuGet 생태계가 계속해서 번창하고 모든 .NET 개발자가 혜택을 받기를 바랍니다.

IronSoftware.Drawing 기능

  • AnyBitmap: 보편적으로 호환되는 Bitmap 클래스. IronSoftware.Drawing.AnyBitmap와 다음 지원 간의 암시적 캐스팅:
    • System.Drawing.Bitmap
    • System.Drawing.Image
    • SkiaSharp.SKBitmap
    • SkiaSharp.SKImage
    • SixLabors.ImageSharp
    • Microsoft.Maui.Graphics.Platform.PlatformImage
  • Color: 보편적으로 호환되는 Color 클래스. IronSoftware.Drawing.Color와 다음 지원 간의 암시적 캐스팅:
    • System.Drawing.Color
    • SkiaSharp.SKColor
    • SixLabors.ImageSharp.Color
    • SixLabors.ImageSharp.PixelFormats
  • Rectangle: 보편적으로 호환되는 Rectangle 클래스. IronSoftware.Drawing.Rectangle와 다음 지원 간의 암시적 캐스팅:
    • System.Drawing.Rectangle
    • SkiaSharp.SKRect
    • SkiaSharp.SKRectI
    • SixLabors.ImageSharp.Rectangle
  • Font: 보편적으로 호환되는 Font 클래스. IronSoftware.Drawing.Font와 다음 지원 간의 암시적 캐스팅:
    • System.Drawing.Font
    • SkiaSharp.SKFont
    • SixLabors.Fonts.Font

호환성

IronSoftware.Drawing는 다음과 호환되는 크로스 플랫폼 지원이 있습니다:

  • .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, .NET Standard 및 .NET Framework 4.62 이상
  • 윈도우, macOS, 리눅스, Docker, Azure, AWS

설치

IronDrawing (IronSoftware.Drawing) NuGet 패키지를 설치하는 것은 빠르고 쉽습니다. 다음과 같이 패키지를 설치해 주세요:

PM > Install-Package IronSoftware.System.Drawing

또는 공식 NuGet 웹사이트에서 직접 다운로드하십시오.

설치가 완료되면 C# 코드의 상단에 using IronSoftware.Drawing;을 추가하여 시작할 수 있습니다.

코드 예제

AnyBitmap 예제

using IronSoftware.Drawing;
using System.IO;
using System.Drawing;

// Create a new AnyBitmap object from a file
// Replace "FILE_PATH" with the actual path of the image you want to process
var bitmap = AnyBitmap.FromFile("FILE_PATH");

// Save the AnyBitmap object as a JPEG file
bitmap.SaveAs("result.jpg");

// Export the AnyBitmap as a byte array
// This can be useful if you want to send the image data over a network or save it in a database
var bytes = bitmap.ExportBytes();

// Create a memory stream to export the AnyBitmap as a JPEG stream with 100% quality
using (var resultExport = new MemoryStream())
{
    // This exports the image to the stream with the specified format and quality
    bitmap.ExportStream(resultExport, AnyBitmap.ImageFormat.Jpeg, 100);
    // Be sure to use 'using' or manually close the stream to release resources
}

// Casting between System.Drawing.Bitmap and IronSoftware.Drawing.AnyBitmap
// Load a System.Drawing.Bitmap from the same file
System.Drawing.Bitmap image = new System.Drawing.Bitmap("FILE_PATH");

// This is an implicit conversion from System.Drawing.Bitmap to IronSoftware.Drawing.AnyBitmap
// This step is necessary if you are working with System.Drawing.Bitmap and need to convert to IronSoftware.Drawing.AnyBitmap for processing
IronSoftware.Drawing.AnyBitmap anyBitmap = AnyBitmap.FromBitmap(image);

// Save the resulting AnyBitmap from casting as a PNG file
anyBitmap.SaveAs("result-from-casting.png");

색상 예시

using IronSoftware.Drawing;
using System;

// The IronSoftware.Drawing library provides enhanced color manipulation features.
// This example demonstrates creating color objects and converting between
// System.Drawing.Color and IronSoftware.Drawing.Color.

// Create a new Color object from a hex string.
Color fromHex = Color.FromHex("#191919");

// Create a new Color object from RGB values.
Color fromRgb = Color.FromRgb(255, 255, 0);

// Create a new Color object using an enumeration.
Color fromEnum = Color.Crimson;

// Casting between System.Drawing.Color and IronSoftware.Drawing.Color.
System.Drawing.Color drawingColor = System.Drawing.Color.Red;

// Convert System.Drawing.Color to IronSoftware.Drawing.Color.
IronSoftware.Drawing.Color ironColor = Color.FromSystemColor(drawingColor);

// Access the alpha, red, green, and blue components of the IronSoftware.Drawing.Color.
byte alpha = ironColor.A;
byte red = ironColor.R;
byte green = ironColor.G;
byte blue = ironColor.B;

// Calculate the luminance of the color.
// Luminance is a value from 0 (black) to 100 (white) where 50 is the perceptual "middle grey".
double luminance = ironColor.GetLuminance();

// Log the calculated attributes to the console.
Console.WriteLine($"Color Details - ARGB: ({alpha}, {red}, {green}, {blue}), Luminance: {luminance}");

직사각형 예시

using IronSoftware.Drawing;
using System.Drawing;

// Declare an IronSoftware.Drawing.Rectangle object
IronSoftware.Drawing.Rectangle ironRectangle = new IronSoftware.Drawing.Rectangle(5, 5, 50, 50);

// Declare a System.Drawing.Rectangle object
System.Drawing.Rectangle systemRectangle = new System.Drawing.Rectangle(10, 10, 150, 150);

// Implicitly convert System.Drawing.Rectangle to IronSoftware.Drawing.Rectangle
// Note: Uncomment and use appropriate conversion methods if available in the IronSoftware.Drawing library
// ironRectangle = (IronSoftware.Drawing.Rectangle)systemRectangle;

// Output the properties of IronSoftware.Drawing.Rectangle if conversion is successful
// These Console.WriteLine statements assume this code runs in a console environment
Console.WriteLine(ironRectangle.X);
Console.WriteLine(ironRectangle.Y);
Console.WriteLine(ironRectangle.Width);
Console.WriteLine(ironRectangle.Height);

글꼴 예시

using System;
using System.Drawing;
using IronSoftware.Drawing;

// Create a new Font object with a specified font family, style, and size
IronSoftware.Drawing.Font font = new IronSoftware.Drawing.Font("Times New Roman", FontStyle.Italic | FontStyle.Bold, 30);

// Create a new instance of System.Drawing.Font
System.Drawing.Font drawingFont = new System.Drawing.Font("Courier New", 30);

try
{
    // Attempt to cast System.Drawing.Font to IronSoftware.Drawing.Font
    // Note: This cast may not be directly possible if the libraries do not support each other;
    // additional conversion logic might be required.
    IronSoftware.Drawing.Font ironFont = new IronSoftware.Drawing.Font(drawingFont.FontFamily.Name, drawingFont.Style, drawingFont.Size);

    // Accessing properties of the IronSoftware.Drawing.Font object
    string familyName = ironFont.FamilyName; // Get the font family name
    FontStyle style = ironFont.Style;       // Get the combined font style (italic, bold, etc.)
    float size = ironFont.Size;             // Get the font size
    bool isItalic = ironFont.Italic;        // Determine if the font style includes Italic
    bool isBold = ironFont.Bold;            // Determine if the font style includes Bold

    // Output the font properties to verify correctness
    Console.WriteLine($"Family: {familyName}, Style: {style}, Size: {size}, Italic: {isItalic}, Bold: {isBold}");
}
catch (InvalidCastException)
{
    Console.WriteLine("The conversion between System.Drawing.Font and IronSoftware.Drawing.Font is not directly supported.");
}
catch (Exception ex)
{
    Console.WriteLine($"An error occurred: {ex.Message}");
}

지원 가능

특허

라이선스 정보는 여기에서 찾을 수 있습니다: LICENSE.txt

기여하다

IronDrawing 오픈 소스 프로젝트에 기여하고 싶다면 라이선스를 읽고 GitHub 저장소에 풀 요청을 하기 전에 확인하십시오.

정보

Iron Software에 대한 자세한 정보를 원하시면 저희 웹사이트를 방문해 주세요: https://ironsoftware.com/

Iron Software 의 지원

일반적인 문의 및 기술적인 질문이 있으시면 support@ironsoftware.com으로 이메일을 보내주십시오.

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

더 읽기

시작할 준비 되셨나요?

NuGet 다운로드 수 22,062,064버전:2026.11방금 출시