Aspose.Imaging
22.2.0
See the version list below for details.
dotnet add package Aspose.Imaging --version 22.2.0
NuGet\Install-Package Aspose.Imaging -Version 22.2.0
<PackageReference Include="Aspose.Imaging" Version="22.2.0" />
paket add Aspose.Imaging --version 22.2.0
#r "nuget: Aspose.Imaging, 22.2.0"
// Install Aspose.Imaging as a Cake Addin #addin nuget:?package=Aspose.Imaging&version=22.2.0 // Install Aspose.Imaging as a Cake Tool #tool nuget:?package=Aspose.Imaging&version=22.2.0
.NET API with Optimized Image Resize Speed
Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License
It is a standalone Imaging API consists of C# routines that enable your .NET applications to draw as well as perform basic to advanced level processing of raster & vector images.
Aspose.Imaging for .NET offers robust image compression and high processing speed through native byte access and a range of efficient algorithms. It not only manipulate, export, and convert images but also lets you dynamically draw objects using pixel manipulation and Graphics Path.
Imaging API Features
- Draw raster images with graphics.
- Draw vector images.
- Converting images to various formats.
- Apply masking as well as Median & Wiener filters.
- Crop, rotate & resize images via API.
- De-skew & transform images.
- Set image properties.
What's new in v22.2.0
Optimized Image Resize Speed
Improved the image resize speed and made it faster.
resize(ResizeType.AdaptiveResample, 3);
resize(ResizeType.AdaptiveResample, 2);
resize(ResizeType.AdaptiveResample, 0.25d);
resize(ResizeType.LanczosResample, 4);
resize(ResizeType.LanczosResample, 0.25d);
private void resize(ResizeType resizeType, double scale)
{
string baseFolder = @"D:\";
string fileName = "tiger.bmp";
string inputFileName = Path.Combine(baseFolder, fileName);
long value = 0;
int count = scale < 1 ? 50 : 5;
for (int i = 0; i < count; i++)
{
using (Image image = Image.Load(inputFileName))
{
var s = new Stopwatch();
s.Start();
image.Resize((int) Math.Round(image.Width * scale),
(int) Math.Round(image.Height * scale), resizeType);
s.Stop();
value += s.ElapsedMilliseconds;
}
}
Console.WriteLine("{0}(scale - {1}:{3} times):
{2:0.00}ms", resizeType, scale, value, count);
}
Accurate Text Alignment
Added the support to perform the pixel perfect text alignment.
string baseFolder = @"D:\test";
string[] alignments = new[] {"Left", "Center", "Right"};
FontSettings.Reset();
FontSettings.SetFontsFolder(Path.Combine(baseFolder, "fonts"));
FontSettings.UpdateFonts();
foreach (var alignment in alignments)
{
DrawString(baseFolder, alignment);
}
private void DrawString(string baseFolder, string align)
{
string fileName = "output_" + align + ".png";
string outputFileName = Path.Combine(baseFolder, fileName);
string[] fontNames = new[]
{
"Arial", "Times New Roman",
"Bookman Old Style", "Calibri", "Comic Sans MS",
"Courier New", "Microsoft Sans Serif", "Tahoma",
"Verdana", "Proxima Nova Rg"
};
float[] fontSizes = new[] { 10f, 22f, 50f, 100f };
int width = 3000;
int height = 3500;
using (System.IO.FileStream stream =
new System.IO.FileStream(outputFileName, System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions
= new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image
= Aspose.Imaging.Image.Create(pngOptions, width, height))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.White);
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush
= new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Black;
float x = 10;
int lineX = 0;
float y = 10;
float w = width - 20;
var pen = new Pen(Color.Red, 1);
StringAlignment alignment = StringAlignment.Near;
switch (align)
{
case "Left":
alignment = StringAlignment.Near;
lineX = (int)Math.Round(x, 0);
break;
case "Center":
alignment = StringAlignment.Center;
lineX = (int)Math.Round(x + w / 2f, 0);
break;
case "Right":
alignment = StringAlignment.Far;
lineX = (int)(x + w);
break;
}
var stringFormat = new StringFormat(StringFormatFlags.ExactAlignment);
stringFormat.Alignment = alignment;
foreach (var fontName in fontNames)
{
foreach (var fontSize in fontSizes)
{
var font = new Font(fontName, fontSize);
string text = String.Format("This is font: {0}, size:{1}", fontName, fontSize);
var s = graphics.MeasureString(text, font, SizeF.Empty, null);
graphics.
DrawString(text, font, brush, new RectangleF(x, y, w, s.Height), stringFormat);
y += s.Height;
}
graphics.DrawLine(pen, new Point((int)(x), (int)y), new Point((int)(x+w), (int)y));
}
graphics.DrawLine(pen, new Point(lineX, 0), new Point(lineX, (int)y));
// save all changes.
image.Save();
}
}
}
Improved YCbCr to RGb Subsampling
This release has improved YCbCr
to RGb
subsampling test coverage for the Jpeg2000
.
string[] files = new string[]
{
"resultyuv420_watermark.jp2", "resultyuv422_watermark.jp2",
"resultyuv444_watermark.jp2"
};
string output = string.Empty;
foreach (string file in files)
{
string path = file;
output = file + ".png";
using (RasterImage image = (RasterImage)Image.Load(path))
{
image.Save(
output,
new PngOptions()
{ ColorType = Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha });
}
}
For a complete list of features, enhancements, and bug fixes in this release please visit, Aspose.Imaging for .NET 22.2.
Read & Write Image Formats
Raster Formats: JPEG2000, JPEG, BMP, TIFF, GIF, PNG, APNG
Medical Imaging: DICOM
Metafiles: EMF, WMF, EMZ, WMZ
Truevision: TGA
Vector Graphics: SVG, SVGZ
Save Images As
Fixed: PDF
Photoshop: PSD
Web: HTML5 Canvas
Read Image Formats
eBook: DjVu
Digital Camera Raw: DNG
OpenOffice: ODG, OTG
Bitmap: DIB
Web Image: WebP
CorelDRAW: CDR (X6, X7), CMX (V2.0 32-bit)
PostScript: EPS
Platform Independence
Aspose.Imaging for .NET can be used to develop applications on Windows Desktop (x86, x64), Windows Server (x86, x64), Windows Azure, Windows Embedded (CE 6.0 R2), as well as Linux x64. The supported platforms include .NET Framework version 2.0 or higher, and .NET Compact Framework 3.5.
Getting Started with Aspose.Imaging for .NET
Are you ready to give Aspose.Imaging for .NET a try? Simply execute Install-Package Aspose.Imaging
from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have Aspose.Imaging for .NET and want to upgrade the version, please execute Update-Package Aspose.Imaging
to get the latest version.
Resize a JPG
Image via C# Code
Execute the below code snippet to see how Aspose.Imaging performs in your environment or please visit the GitHub Repository for other common usage scenarios.
using (Image image = Image.Load(dir + "template.jpg"))
{
image.Resize(300, 300);
image.Save(dir + "output.jpg");
}
Recover a Broken TIFF
using C# Code
You can programmatically recover a damaged TIFF file with the help of Aspose.Imaging for .NET API as demonstrated below.
// create an instance of LoadOptions and set LoadOptions properties
var loadOptions = new LoadOptions();
loadOptions.DataRecoveryMode = DataRecoveryMode.ConsistentRecover;
loadOptions.DataBackgroundColor = Color.Red;
// create an instance of Image and load a damaged image by passing the instance of LoadOptions
using (var image = Image.Load(dir + "template.tiff", loadOptions))
{
// do processing
}
Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net20 is compatible. net35 is compatible. net35-client is compatible. net40 is compatible. net40-client is compatible. net403 was computed. net45 was computed. 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 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- System.Drawing.Common (>= 5.0.0)
- System.Text.Encoding.CodePages (>= 5.0.0)
-
.NETFramework 2.0
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 3.5 Client
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.0 Client
- No dependencies.
-
.NETStandard 2.0
- System.Drawing.Common (>= 5.0.0)
- System.Text.Encoding.CodePages (>= 5.0.0)
-
net5.0
- System.Drawing.Common (>= 5.0.0)
- System.Text.Encoding.CodePages (>= 5.0.0)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Aspose.Imaging:
Package | Downloads |
---|---|
Aspose.Total
Aspose.Total for .NET is the most complete package of all .NET file format APIs offered by Aspose. It empowers developers to create, edit, render, print and convert between a wide range of popular document formats within any .NET, C#, ASP.NET and VB.NET applications. |
|
Weavy.Core
A class library containing core business logic, data access and utility methods required by Weavy. |
|
SenseNet.Preview.Aspose.PreviewImageGenerators
Aspose Preview image generator classes for the sensenet platform. |
|
SenseNet.Preview.Aspose
sensenet Aspose Preview Provider makes it possible to generate and serve preview images using Aspose libraries. |
|
NovaQual.DocumentConversionLib
This contains all the document conversions functionality e.g word to pdf, exce to pdf etc |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
24.11.0 | 6,263 | 11/5/2024 | |
24.10.0 | 15,825 | 10/8/2024 | |
24.9.0 | 27,474 | 9/5/2024 | |
24.8.0 | 25,927 | 8/5/2024 | |
24.7.0 | 23,005 | 7/3/2024 | |
24.6.0 | 32,513 | 6/4/2024 | |
24.5.0 | 39,292 | 5/3/2024 | |
24.4.0 | 29,065 | 4/4/2024 | |
24.3.0 | 49,170 | 3/11/2024 | |
24.2.0 | 42,764 | 2/1/2024 | |
23.12.0 | 161,861 | 12/18/2023 | |
23.11.0 | 36,321 | 11/29/2023 | |
23.10.0 | 54,195 | 10/30/2023 | |
23.9.0 | 115,982 | 9/26/2023 | |
23.8.0 | 74,283 | 8/29/2023 | |
23.7.0 | 48,222 | 7/31/2023 | |
23.6.0 | 60,736 | 6/29/2023 | |
23.5.1 | 74,105 | 5/30/2023 | |
23.5.0 | 10,854 | 5/25/2023 | |
23.4.0 | 92,437 | 4/27/2023 | |
23.3.0 | 62,009 | 3/30/2023 | |
23.3.0-beta | 3,344 | 3/18/2023 | |
23.2.0 | 105,827 | 2/20/2023 | |
22.12.0 | 142,508 | 12/5/2022 | |
22.11.0 | 72,064 | 11/14/2022 | |
22.10.0 | 68,903 | 10/3/2022 | |
22.10.0-beta | 194,533 | 9/28/2022 | |
22.9.0 | 67,000 | 9/2/2022 | |
22.8.0 | 54,798 | 8/4/2022 | |
22.7.0 | 43,670 | 7/7/2022 | |
22.6.0 | 50,543 | 6/7/2022 | |
22.6.0-beta2 | 2,737 | 6/1/2022 | |
22.5.0 | 54,705 | 5/13/2022 | |
22.4.0 | 50,396 | 4/11/2022 | |
22.3.0 | 74,065 | 3/7/2022 | |
22.2.0 | 117,115 | 2/1/2022 | |
21.12.0 | 85,498 | 12/1/2021 | |
21.11.0 | 44,526 | 11/3/2021 | |
21.10.0 | 38,030 | 10/7/2021 | |
21.9.0 | 41,211 | 9/13/2021 | |
21.9.0-beta | 10,389 | 8/23/2021 | |
21.8.0 | 34,158 | 8/5/2021 | |
21.8.0-beta | 4,401 | 7/19/2021 | |
21.7.0 | 36,072 | 7/5/2021 | |
21.7.0-beta | 5,578 | 6/21/2021 | |
21.6.0 | 40,103 | 6/1/2021 | |
21.6.0-beta | 5,483 | 5/21/2021 | |
21.5.0 | 46,927 | 5/6/2021 | |
21.5.0-beta | 4,455 | 4/19/2021 | |
21.4.0 | 34,884 | 4/5/2021 | |
21.3.0 | 41,433 | 3/9/2021 | |
21.3.0-beta | 5,748 | 2/20/2021 | |
21.2.0 | 25,397 | 2/8/2021 | |
21.2.0-beta2 | 2,361 | 2/19/2021 | |
21.2.0-beta | 2,329 | 2/3/2021 | |
20.12.0 | 55,147 | 12/31/2020 | |
20.12.0-beta | 4,096 | 12/16/2020 | |
20.11.0 | 50,564 | 11/26/2020 | |
20.11.0-beta | 3,477 | 11/17/2020 | |
20.10.0 | 14,198 | 10/24/2020 | |
20.10.0-beta | 4,527 | 10/16/2020 | |
20.9.0 | 35,679 | 9/28/2020 | |
20.9.0-beta | 2,462 | 9/16/2020 | |
20.8.0 | 22,487 | 8/26/2020 | |
20.8.0-beta | 3,802 | 8/12/2020 | |
20.7.0 | 16,128 | 7/22/2020 | |
20.6.0 | 20,839 | 6/17/2020 | |
20.5.0 | 23,538 | 5/20/2020 | |
20.4.0 | 36,860 | 4/23/2020 | |
20.3.0 | 119,796 | 3/19/2020 | |
20.2.0 | 13,989 | 2/21/2020 | |
19.12.0 | 44,424 | 12/16/2019 | |
19.11.0 | 43,460 | 11/13/2019 | |
19.10.0 | 15,749 | 10/4/2019 | |
19.9.0 | 19,427 | 9/10/2019 | |
19.7.0 | 8,129 | 7/30/2019 | |
19.6.0 | 17,903 | 6/28/2019 | |
19.4.0 | 61,485 | 4/25/2019 | |
19.3.0 | 9,936 | 3/28/2019 | |
19.2.0 | 8,509 | 2/27/2019 | |
19.1.0 | 13,293 | 1/23/2019 |