FrameworkExtensions.System.Drawing
1.0.0.49
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
.NET Framework 3.5
This package targets .NET Framework 3.5. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package FrameworkExtensions.System.Drawing --version 1.0.0.49
NuGet\Install-Package FrameworkExtensions.System.Drawing -Version 1.0.0.49
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FrameworkExtensions.System.Drawing" Version="1.0.0.49" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FrameworkExtensions.System.Drawing" Version="1.0.0.49" />
<PackageReference Include="FrameworkExtensions.System.Drawing" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FrameworkExtensions.System.Drawing --version 1.0.0.49
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FrameworkExtensions.System.Drawing, 1.0.0.49"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FrameworkExtensions.System.Drawing@1.0.0.49
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FrameworkExtensions.System.Drawing&version=1.0.0.49
#tool nuget:?package=FrameworkExtensions.System.Drawing&version=1.0.0.49
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Extensions to System.Drawing
Extension methods for System.Drawing types (bitmaps, images, colors, graphics).
Extension Methods
Bitmap Extensions (Bitmap)
Bitmap Locking
Lock(...)- Lock bitmap for direct pixel access (8 overloads for different combinations)Lock()- Lock entire bitmap with ReadWrite modeLock(Rectangle)- Lock regionLock(ImageLockMode)- Lock with specific modeLock(PixelFormat)- Lock with specific formatLock(Rectangle, ImageLockMode)Lock(Rectangle, PixelFormat)Lock(ImageLockMode, PixelFormat)Lock(Rectangle, ImageLockMode, PixelFormat)- Full control- Returns format-specific
IBitmapLockerimplementation
Transformations
ConvertPixelFormat(PixelFormat)- Convert bitmap to different pixel formatCrop(Rectangle, PixelFormat = DontCare)- Extract region from bitmapResize(int width, int height, InterpolationMode = Bicubic)- Resize bitmapRotated(float angle, Point? center = null)- Create rotated copy of bitmapRotateInplace(float angle, Point? center = null)- Rotate bitmap in-placeRotateTo(Bitmap target, float angle, Point? center = null)- Rotate to target bitmap
Image Extensions (Image)
Multi-Page Support
GetPageAt(int page)- Get specific page from multi-page image (e.g., TIFF)GetPageCount()- Get total number of pages in image
Save Operations
SaveToPng(FileInfo/string)- Save image as PNGSaveToTiff(string)- Save image as TIFFSaveToJpeg(string/Stream, double quality = 1)- Save as JPEG with quality (0.0-1.0)
Conversions
ToIcon(int targetRes = 0)- Convert image to IconToBase64DataUri()- Convert to Base64 data URI stringFromBase64DataUri(string)(static-like extension on string) - Create image from Base64 data URI
Image Processing
MakeGrayscale()- Convert image to grayscaleThreshold(byte threshold = 127)- Apply threshold filter (black/white)ApplyPixelProcessor(Func<Color, Color> processor)- Apply custom pixel transformation functionMirrorAlongX()- Mirror horizontallyMirrorAlongY()- Mirror verticallyResize(int longSide)- Resize to fit within square, keep aspectResize(int longSide, Color fillColor)- Resize with fill colorResize(int width, int height, bool keepAspect = true, Color? fillColor = null)- Resize with optionsResize(int width = -1, int height = -1, InterpolationMode = Default)- Resize with interpolationRotate(float angle)- Rotate image by angleGetRectangle(Rectangle)- Extract rectangular regionReplaceColorWithTransparency(Color)- Replace specific color with transparency
Color Extensions (Color)
Color Space Conversion
GetLuminance()- Calculate luminance (Y component in YUV)GetChrominanceU()- Calculate U chrominance componentGetChrominanceV()- Calculate V chrominance component
Color Comparison
IsLike(Color other, byte luminanceDelta = 24, byte chromaUDelta = 7, byte chromaVDelta = 6)- Compare colors in YUV space with toleranceIsLikeNaive(Color other, int tolerance = 2)- Simple RGB comparison with tolerance
Color Blending
BlendWith(Color other, float current, float max)- Interpolate between two colors
Graphics Extensions (Graphics)
DrawString(float x, float y, string text, Font font, Brush brush, ContentAlignment anchor)- Draw text with anchor positioningDrawCross(float/int x, float/int y, float/int size, Pen pen)- Draw cross marker (4 overloads including Point/PointF)DrawCircle(Pen pen, float centerX, float centerY, float radius)- Draw circle outlineFillCircle(Brush brush, float centerX, float centerY, float radius)- Draw filled circle
Rectangle Extensions (Rectangle)
MultiplyBy(int factor)- Scale rectangle uniformlyMultiplyBy(int xfactor, int yfactor)- Scale rectangle with different X/Y factorsCollidesWith(Rectangle/RectangleF)- Check rectangle collisionCollidesWith(Point/PointF)- Check if point is insideCollidesWith(int x, int y)/CollidesWith(float x, float y)- Check if coordinates are insideCenter()- Get center pointSetLeft/SetRight/SetTop/SetBottom(int)- Create new rectangle with modified edge
RectangleF Extensions (RectangleF)
(Similar methods to Rectangle, for floating-point rectangles)
Size Extensions (Size)
Center()- Get center point
Point Extensions (Point)
(Generated from T4 template - numeric operations on points)
FileInfo Extensions (FileInfo)
GetIcon(bool smallIcon = false, bool linkOverlay = false)- Get Windows shell icon for file- Uses native SHGetFileInfo API
Custom Types
IBitmapLocker Interface
Format-specific bitmap pixel access implementations:
- ARGB32BitmapLocker - 32-bit ARGB (Format32bppArgb)
- RGB32BitmapLocker - 32-bit RGB (Format32bppRgb)
- RGB24BitmapLocker - 24-bit RGB (Format24bppRgb)
- RGB565BitmapLocker - 16-bit RGB 565 (Format16bppRgb565)
- ARGB1555BitmapLocker - 16-bit ARGB 1555 (Format16bppArgb1555)
- Gray16BitmapLocker - 16-bit grayscale (Format16bppGrayScale)
- RGB555BitmapLocker - 16-bit RGB 555 (Format16bppRgb555)
- Indexed8BitmapLocker - 8-bit indexed (Format8bppIndexed)
- IndexedBitmapLocker - 1-bit and 4-bit indexed (Format1bppIndexed, Format4bppIndexed)
- UnsupportedDrawingBitmapLocker - Fallback for unsupported formats
Each locker provides optimized pixel access for its specific format.
Installation
dotnet add package FrameworkExtensions.System.Drawing
License
LGPL 3.0 or later - See LICENSE for details
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
| .NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- FrameworkExtensions.Backports (>= 1.0.0.183)
-
.NETFramework 3.5
- FrameworkExtensions.Backports (>= 1.0.0.183)
-
.NETFramework 4.0
- FrameworkExtensions.Backports (>= 1.0.0.183)
-
.NETFramework 4.5
- FrameworkExtensions.Backports (>= 1.0.0.183)
-
.NETFramework 4.8
- FrameworkExtensions.Backports (>= 1.0.0.183)
-
net6.0-windows7.0
- FrameworkExtensions.Backports (>= 1.0.0.183)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0.91 | 82 | 1/19/2026 |
| 1.0.0.79 | 92 | 1/5/2026 |
| 1.0.0.70 | 102 | 12/29/2025 |
| 1.0.0.55 | 181 | 12/22/2025 |
| 1.0.0.49 | 213 | 12/15/2025 |
| 1.0.0.46 | 206 | 9/29/2025 |
| 1.0.0.45 | 197 | 8/4/2025 |
| 1.0.0.37 | 191 | 7/7/2025 |
| 1.0.0.36 | 226 | 2/24/2025 |
| 1.0.0.35 | 310 | 6/24/2024 |
| 1.0.0.33 | 190 | 6/17/2024 |
| 1.0.0.31 | 194 | 6/10/2024 |
| 1.0.0.30 | 179 | 5/27/2024 |
| 1.0.0.29 | 199 | 5/6/2024 |
| 1.0.0.27 | 196 | 4/29/2024 |
| 1.0.0.25 | 208 | 4/1/2024 |
| 1.0.0.24 | 191 | 3/25/2024 |
| 1.0.0.23 | 185 | 3/5/2024 |
| 1.0.0.22 | 260 | 7/23/2023 |
| 1.0.0.21 | 236 | 7/21/2023 |
| 1.0.0.20 | 241 | 7/19/2023 |
| 1.0.0.19 | 222 | 7/19/2023 |
| 1.0.0.17 | 247 | 7/19/2023 |