Class TiffImage
Der Name: Aspose.Imaging.FileFormats.Tiff Versammlung: Aspose.Imaging.dll (25.4.0)
Prozess Tagged Image File Format (TIFF) raster Bilder mit unserer API, bietetumfassende Unterstützung für verschiedene Auflösungen und fortgeschrittene Editing-Fähigkeitenwie EXIF-Datenmanipulation und alpha-Kanäle. Normalisieren Sie die Winkel für geschkante Bilder,umzuwandeln, in grayscale umzuwandeln und Filter, Gamma Korrekturen und Bild anzuwendenParameter Anpassungen mit Leichtigkeit. unbequeme Handhabung von Multi-Frame TIFF-Dateien,Kreieren Sie grafische Paths, fügen Sie Formen hinzu und speichern Sie Bilder in unterschiedliche Formate.
[JsonObject(MemberSerialization.OptIn)]
public class TiffImage : RasterCachedMultipageImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IMultipageImageExt, IMultipageImage, IHasExifData, IHasXmpData, IHasMetadata
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← RasterCachedMultipageImage ← TiffImage
Derived
Implements
IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IMultipageImageExt , IMultipageImage , IHasExifData , IHasXmpData , IHasMetadata
Vererbte Mitglieder
RasterCachedMultipageImage.AdjustBrightness(int) , RasterCachedMultipageImage.AdjustContrast(float) , RasterCachedMultipageImage.AdjustGamma(float, float, float) , RasterCachedMultipageImage.AdjustGamma(float) , RasterCachedMultipageImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedMultipageImage.BinarizeFixed(byte) , RasterCachedMultipageImage.BinarizeBradley(double, int) , RasterCachedMultipageImage.BinarizeBradley(double) , RasterCachedMultipageImage.BinarizeOtsu() , RasterCachedMultipageImage.Crop(Rectangle) , RasterCachedMultipageImage.Crop(int, int, int, int) , RasterCachedMultipageImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedMultipageImage.Grayscale() , RasterCachedMultipageImage.NormalizeHistogram() , RasterCachedMultipageImage.Rotate(float, bool, Color) , RasterCachedMultipageImage.RotateFlip(RotateFlipType) , RasterCachedMultipageImage.RotateFlipAll(RotateFlipType) , RasterCachedMultipageImage.Resize(int, int, ResizeType) , RasterCachedMultipageImage.Resize(int, int, ImageResizeSettings) , RasterCachedMultipageImage.ResizeWidthProportionally(int, ResizeType) , RasterCachedMultipageImage.ResizeHeightProportionally(int, ResizeType) , RasterCachedMultipageImage.ReplaceColor(int, byte, int) , RasterCachedMultipageImage.ReplaceNonTransparentColors(int) , RasterCachedMultipageImage.Filter(Rectangle, FilterOptionsBase) , RasterCachedMultipageImage.NormalizeAngle(bool, Color) , RasterCachedMultipageImage.CacheData() , RasterCachedMultipageImage.ReleaseManagedResources() , RasterCachedMultipageImage.ResizeMain(int, int, ResizeType) , RasterCachedMultipageImage.RotateFlipMain(RotateFlipType) , RasterCachedMultipageImage.CropMain(int, int, int, int) , RasterCachedMultipageImage.SavePixelsInternalMain(Rectangle, int[]) , RasterCachedMultipageImage.CanDoAdjustments() , RasterCachedMultipageImage.GetPagesAsEnumerable() , RasterCachedMultipageImage.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , RasterCachedMultipageImage.Height , RasterCachedMultipageImage.Width , RasterCachedMultipageImage.BitsPerPixel , RasterCachedMultipageImage.IsCached , RasterCachedMultipageImage.PageCount , RasterCachedMultipageImage.Pages , RasterCachedMultipageImage.HasAlpha , RasterCachedMultipageImage.HasTransparentColor , RasterCachedMultipageImage.ImageOpacity , RasterCachedMultipageImage.BackgroundColor , RasterCachedMultipageImage.XmpData , RasterCachedMultipageImage.PageExportingAction , RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.OnCached() , RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette) , RasterCachedImage.IsCached , RasterImage.xmpData , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.ReleaseManagedResources() , RasterImage.UpdateMetadata() , RasterImage.UpdateDimensions(int, int) , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , RasterImage.DataLoader , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.UpdateContainer(Image) , Image.GetCanNotSaveMessage(ImageOptionsBase) , Image.GetFitRectangle(Rectangle) , Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter) , Image.GetFitRectangle(Rectangle, int[]) , Image.OnPaletteChanged(IColorPalette, IColorPalette) , Image.OnPaletteChanging(IColorPalette, IColorPalette) , Image.ReleaseManagedResources() , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.timeout , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.SaveData(Stream) , DataStreamSupporter.ReleaseManagedResources() , DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Create Graphics Path from Path Resources in TIFF Image.
using (var image = (TiffImage)Image.Load("Bottle.tif"))
{
// Create the GraphicsPath using PathResources from TIFF image
var graphicsPath = PathResourceConverter.ToGraphicsPath(image.ActiveFrame.PathResources.ToArray(), image.ActiveFrame.Size);
var graphics = new Graphics(image);
// Draw red line and save the image
graphics.DrawPath(new Pen(Color.Red, 10), graphicsPath);
image.Save("BottleWithRedBorder.tif");
}
Erstellen Sie Path Resources mit Graphics Path.
static void Main(string[] args)
{
using (var image = (TiffImage)Image.Load("Bottle.tif"))
{
// Create rectangular Figure for GraphicsPath
var figure = new Figure();
figure.AddShape(CreateBezierShape(100f, 100f, 500f, 100f, 500f, 1000f, 100f, 1000f));
// Create GraphicsPath using our Figure
var graphicsPath = new GraphicsPath();
graphicsPath.AddFigure(figure);
// Set PathResources using GraphicsPath
var pathResouze = PathResourceConverter.FromGraphicsPath(graphicsPath, image.Size);
image.ActiveFrame.PathResources = new List<pathresource>(pathResouze);
// Save the image
image.Save("BottleWithRectanglePath.tif");
}
}
private static BezierShape CreateBezierShape(params float[] coordinates)
{
var bezierPoints = CoordinatesToBezierPoints(coordinates).ToArray();
return new BezierShape(bezierPoints, true);
}
private static IEnumerable<pointf> CoordinatesToBezierPoints(float[] coordinates)
{
for (var coordinateIndex = 0; coordinateIndex < coordinates.Length; coordinateIndex += 2)
for (var index = 0; index < 3; index++)
yield return new PointF(coordinates[coordinateIndex], coordinates[coordinateIndex + 1]);
}</pointf></pathresource>
Constructors
TiffImage(TiffFrame)
Initialisieren Sie ein neues Objekt der Aspose.Imaging.FileFormats.Tiff.TiffImage Klasse, die dieRahmenparameter. Dieser Konstruktor erleichtert die Erstellung eines TiffImagezum Beispiel, die Entwicklern erlaubt, den Rahmen zu angeben, der geladen oder verarbeitet werden soll,Verstärken Sie die Aufgaben der TIFF Image Management innerhalb ihrer Anwendungen.
public TiffImage(TiffFrame frame)
Parameters
frame
TiffFrame
Das Tiff-Frame, um das Bild mit zu initialisieren.
Examples
Dieses Beispiel zeigt, wie man ein TIFF-Bild aus dem Schnitt erstellen und es in eine Datei speichern kann.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Set the RGB color model.
createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// All color components will be stored within a single plane.
createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create a TIFF Frame of 100x100 px.
// Note that you don't have to dispose a frame explicitly if it is included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
// Fill the entire frame with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
// Create a TIFF image.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
{
tiffImage.Save(dir + "output.tif");
}
Exceptions
Tiff frame’ kann nicht leer sein.
TiffImage(TiffFrame[])
Erstellen Sie eine neue Instanz der Aspose.Imaging.FileFormats.Tiff.TiffImage Klasse, die eine Liste derFrame als Parameter. Dieser Konstruktor ermöglicht die Initialisierung eines TiffImageObjekte mit mehreren Framen, die eine effiziente Handhabung und Verarbeitung vonTIFF Bildsequenzen innerhalb von Software-Anwendungen.
public TiffImage(TiffFrame[] frames)
Parameters
frames
TiffFrame
[][]
und die Frame.
Examples
Dieses Beispiel zeigt, wie man ein TIFF-Bild mit 2 Framen erstellen und es in eine Datei speichern kann.
string dir = "c:\\temp\\";
// Options for the first frame
Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Set the RGB color model.
createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// All color components will be stored within a single plane.
createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create the first TIFF frame of 100x100 px.
// Note that you don't have to dispose frames explicitly if they are included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
// Fill the first frame with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(frame1.Width, frame1.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
graphics.FillRectangle(gradientBrush, frame1.Bounds);
// Options for the first frame
Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 1 bit per pixel for a B/W image.
createOptions2.BitsPerSample = new ushort[] { 1 };
// Set the Little Endian byte order (Intel)
createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
// Set the CCITT Group 3 Fax compression.
createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
// Set the B/W color model where 0 is black, 1 is white.
createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
// Create the second TIFF frame of 200x200px.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
// Fill the second frame with the blue-yellow gradient.
// It will be automatically converted to the B/W format due to the corresponding settings of the frame.
Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
graphics2.FillRectangle(gradientBrush, frame2.Bounds);
// Create a TIFF image.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(
new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
{
tiffImage.Save(dir + "output.mutliframe.tif");
}
Exceptions
Frame
Properties
ActiveFrame
Verwaltung des aktiven Frames unbequem, die dynamische Navigation erleichtert undManipulation innerhalb des angegebenen Kontextes. Ihre Anwendung zu interagieren ermöglicheneffizient mit Multimedia-Inhalte, Verbesserung der Benutzerbeziehung und Produktivität.
public TiffFrame ActiveFrame { get; set; }
Eigentumswert
Examples
Das folgende Beispiel zeigt, wie man ein TIFF-Mutlipage aus einzelnen Rasterbildern zusammensetzt.
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// This is Font and Brush for drawing text on individual frames.
Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
// Create 5 frames
for (int i = 1; i <= 5; i++)
{
Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
// Create a PNG image and draw the number of page on it.
Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
gr.DrawString(i.ToString(), font, brush, 10, 10);
// Create a frame based on the PNG image.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
// Add the frame to the TIFF image.
tiffImage.AddFrame(frame);
}
// The image was created with a single default frame. Let's remove it.
Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
tiffImage.ActiveFrame = tiffImage.Frames[1];
tiffImage.RemoveFrame(0);
// Don't forget to dispose the frame if you won't add it to some other TiffImage
activeFrame.Dispose();
tiffImage.Save();
}
ByteOrder
Übereinstimmen Sie die Byte-Bestellung für TIFF-Dateien unbequem, um eine genaue Kontrolle überDateninterpretation. Erleichtern Sie Ihre Anwendungen mit der Flexibilität, sich anvielfältige Dateispecifikationen, die Kompatibilität und Effizienz bei der Datenverarbeitung verbessern.
public TiffByteOrder ByteOrder { get; set; }
Eigentumswert
ExifData
Zugriff oder Änderung von EXIF-Daten, die mit dem aktiven Rahmen verbunden sind, unmittelbarpräzise Kontrolle über Bildermetadata. Verbesserung der Kapazitäten Ihrer Anwendung durchintegrieren diese Funktion, sicherzustellen, dass präzise Erhaltung und Anpassung vonwesentliche Bildinformationen.
public ExifData ExifData { get; set; }
Eigentumswert
FileFormat
Wiederherstellen des Dateiformats mit dem Bild verbundenen Wert. Diese Eigenschaft dient alsein kritisches Aspekt der Bildmetadatenerfassung, die Softwareanwendungen ermöglicht,Identifizieren und interpretieren Sie das Format der Bilddaten effizient.
public override FileFormat FileFormat { get; }
Eigentumswert
Frames
Erhalten Sie eine Reihe von Aspose.Imaging.FileFormats.Tiff.TiffFrame-Einstellungen, die umfassendeZugang und Manipulation einzelner Frame innerhalb des TIFF-Bildes.Leistung dieser Array, um die Workflows der Bildverarbeitung zu vereinfachen, um Präzision zu gewährleistenKontrolle und Optimierung visueller Inhalte.
public TiffFrame[] Frames { get; }
Eigentumswert
TiffFrame [][]
Examples
Das folgende Beispiel zeigt, wie man ein TIFF-Mutlipage aus einzelnen Rasterbildern zusammensetzt.
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// This is Font and Brush for drawing text on individual frames.
Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
// Create 5 frames
for (int i = 1; i <= 5; i++)
{
Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
// Create a PNG image and draw the number of page on it.
Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
gr.DrawString(i.ToString(), font, brush, 10, 10);
// Create a frame based on the PNG image.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
// Add the frame to the TIFF image.
tiffImage.AddFrame(frame);
}
// The image was created with a single default frame. Let's remove it.
Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
tiffImage.ActiveFrame = tiffImage.Frames[1];
tiffImage.RemoveFrame(0);
// Don't forget to dispose the frame if you won't add it to some other TiffImage
activeFrame.Dispose();
tiffImage.Save();
}
HasAlpha
Bestimmen Sie, ob das Bild einen alpha-Kanal hat und entscheidende Informationen bietetfür rendering und compositing operationen. integrieren Sie diese funktion, um zu optimierenvisuelle Verarbeitungsarbeitströme, die eine genaue Darstellung und Manipulation derTransparente Elemente.
public override bool HasAlpha { get; }
Eigentumswert
Examples
Das folgende Beispiel laden ein TIFF-Bild auf und drucken Informationen über das Rohdatenformat und den Alpha-Kanal.
string dir = "c:\\temp\\";
string fileName = dir + "sample.tif";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// If the active TIFF frame has alpha channel, then the entire TIFF image is considered to have alpha channel.
System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, tiffImage.RawDataFormat, tiffImage.HasAlpha);
int i = 0;
foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
{
System.Console.WriteLine("Frame={0}, FileFormat={1}, HasAlpha={2}", ++i, frame.RawDataFormat, frame.HasAlpha);
}
}
// The output may look like this:
// ImageFile=c:\temp\sample.tif, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
// Frame=1, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
// Frame=2, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
HorizontalResolution
Wiederherstellen der horizontalen Auflösung des angegebenen Aspose.Imaging.Image in Pixelnpro Zoll, die präzise Anpassung und Leistungsfähigkeit erleichtert.wesentliche Image-Metadaten anstrengend, die gestärkt die Bildverarbeitung ermöglichenArbeitsflüsse für verbesserte Benutzererfahrungen.
public override double HorizontalResolution { get; set; }
Eigentumswert
Examples
Das folgende Beispiel zeigt, wie man eine horizontale/vertikale Auflösung eines TIFF-Bildes festlegt.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Get horizontal and vertical resolution of the TiffImage.
double horizontalResolution = tiffImage.HorizontalResolution;
double verticalResolution = tiffImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
tiffImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
}
}
Remarks
Bitte beachten Sie, dass diese Wert immer 96 ist, da verschiedene Plattformen die Bildschirmresolution nicht zurückgeben können. Sie können die SetResolution-Methode verwenden, um beide Resolutionwerte in einem einzigen Anruf zu aktualisieren.
PageCount
Wiederherstellen der Gesamtzahl der Seiten innerhalb des angegebenen Dokuments, dieEffiziente Navigation und Verwaltung von mehrseiten Inhalten.Funktionalität zur Verbesserung der Benutzererfahrung, die unbequeme Zugang zuumfassende Dokumentstrukturen.
public override int PageCount { get; }
Eigentumswert
Pages
Zugriff auf die Seiten des Dokuments unbeweglich, wodurch dynamische Navigation undManipulation innerhalb der Inhaltsstruktur. Erleichtern Sie Ihre Anwendung effizientZugang zu einzelnen Seiten, die eine effiziente Dokumentverarbeitung undVerbesserte Benutzerinteraktion.
public override Image[] Pages { get; }
Eigentumswert
Image [][]
PremultiplyComponents
Angeben, ob Komponenten eine Vorverlängerung benötigen, um eine effiziente Handhabung zu gewährleistender visuellen Elemente. Verbesserung der Rendering-Prozesse durch die Entfernung dieser Eigenschaft,die grafischen Arbeitsflüsse für optimierte Leistung gestärkt.
public override bool PremultiplyComponents { get; set; }
Eigentumswert
Examples
Das folgende Beispiel erzeugt eine neue TIFF-Funktion, speichert die angegebenen halb transparenten Pixel, ladet dann diese Pixel hoch und erhält endgültige Farben in der vor multiplizierten Form.
int imageWidth = 3;
int imageHeight = 2;
Aspose.Imaging.Color[] colors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.FromArgb(127, 255, 0, 0),
Aspose.Imaging.Color.FromArgb(127, 0, 255, 0),
Aspose.Imaging.Color.FromArgb(127, 0, 0, 255),
Aspose.Imaging.Color.FromArgb(127, 255, 255, 0),
Aspose.Imaging.Color.FromArgb(127, 255, 0, 255),
Aspose.Imaging.Color.FromArgb(127, 0, 255, 255),
};
Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffDeflateRgba);
createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Create(createOptions, imageWidth, imageHeight))
{
// Save pixels for the whole image.
image.SavePixels(image.Bounds, colors);
// The pixels are stored in the original image in the non-premultiplied form.
// Need to specify the corresponding option explicitly to obtain premultiplied color components.
// The premultiplied color components are calculated by the formulas:
// red = original_red * alpha / 255;
// green = original_green * alpha / 255;
// blue = original_blue * alpha / 255;
image.PremultiplyComponents = true;
Aspose.Imaging.Color[] premultipliedColors = image.LoadPixels(image.Bounds);
for (int i = 0; i < colors.Length; i++)
{
System.Console.WriteLine("Original color: {0}", colors[i].ToString());
System.Console.WriteLine("Premultiplied color: {0}", premultipliedColors[i].ToString());
}
}
//The output will look like this:
//Original color: Color [A=127, R=255, G=0, B=0]
//Premultiplied color: Color [A=127, R=127, G=0, B=0]
//Original color: Color [A=127, R=0, G=255, B=0]
//Premultiplied color: Color [A=127, R=0, G=127, B=0]
//Original color: Color [A=127, R=0, G=0, B=255]
//Premultiplied color: Color [A=127, R=0, G=0, B=127]
//Original color: Color [A=127, R=255, G=255, B=0]
//Premultiplied color: Color [A=127, R=127, G=127, B=0]
//Original color: Color [A=127, R=255, G=0, B=255]
//Premultiplied color: Color [A=127, R=127, G=0, B=127]
//Original color: Color [A=127, R=0, G=255, B=255]
//Premultiplied color: Color [A=127, R=0, G=127, B=127]
VerticalResolution
Zugriff auf die vertikale Auflösung des angegebenen Aspose.Imaging.Image in Pixeln proInches, die präzise Anpassungen und Rendering-Optimisationen ermöglichen.Bilddaten anstrengend, um die Workflows der Bildverarbeitung zu vereinfachen, sicherzustellenQualität und Leistung in Ihren Anwendungen.
public override double VerticalResolution { get; set; }
Eigentumswert
Examples
Das folgende Beispiel zeigt, wie man eine horizontale/vertikale Auflösung eines TIFF-Bildes festlegt.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Get horizontal and vertical resolution of the TiffImage.
double horizontalResolution = tiffImage.HorizontalResolution;
double verticalResolution = tiffImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
tiffImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
}
}
Remarks
Bitte beachten Sie, dass diese Wert immer 96 ist, da verschiedene Plattformen die Bildschirmresolution nicht zurückgeben können. Sie können die SetResolution-Methode verwenden, um beide Resolutionwerte in einem einzigen Anruf zu aktualisieren.
Methods
Add(TiffImage)
Fügen Sie die Frame aus dem angegebenen Bild unbequem in das aktuelle Frame hinzu,Konsolidieren Sie Ihre Inhalte und verbessern Sie die Zusammensetzung der Flexibilität.diese Methode, um die Frame Management und Manipulation innerhalb IhresAnwendung, die eine effiziente Handhabung von Multi-Frame-Bilder erleichtert.
public void Add(TiffImage image)
Parameters
image
TiffImage
Das Quellbild.
AddFrame(TiffFrame)
Einbeziehen Sie das angegebenen Rahmen unbequem in das Bild, um seinen Inhalt zu erweiternund Vielseitigkeit. Verwenden Sie diese Methode, um die Bildkomposition und das Management zu verbessern,die effiziente Handhabung von mehrframe Bilder innerhalb Ihrer Anwendung ermöglichen.
public void AddFrame(TiffFrame frame)
Parameters
frame
TiffFrame
Das Frame zu hinzufügen.
Examples
Das folgende Beispiel zeigt, wie man ein TIFF-Mutlipage aus einzelnen Rasterbildern zusammensetzt.
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// This is Font and Brush for drawing text on individual frames.
Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
// Create 5 frames
for (int i = 1; i <= 5; i++)
{
Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
// Create a PNG image and draw the number of page on it.
Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
gr.DrawString(i.ToString(), font, brush, 10, 10);
// Create a frame based on the PNG image.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
// Add the frame to the TIFF image.
tiffImage.AddFrame(frame);
}
// The image was created with a single default frame. Let's remove it.
Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
tiffImage.ActiveFrame = tiffImage.Frames[1];
tiffImage.RemoveFrame(0);
// Don't forget to dispose the frame if you won't add it to some other TiffImage
activeFrame.Dispose();
tiffImage.Save();
}
AddFrames(TiffFrame[])
Integrieren Sie die Reihe von Framen unbeweglich in das Bild, bereichern Sie seine Inhalte undVerschiedenheit. Verwenden Sie diese Methode, um die Bildkomposition und das Management zu verbessern,ermöglicht eine effiziente Verarbeitung von Multi-Frame-Bilder innerhalb Ihrer Anwendung.
public void AddFrames(TiffFrame[] frames)
Parameters
frames
TiffFrame
[][]
Die Frame versuchen, hinzuzufügen
AddPage(RasterImage)
Einfügen Sie eine neue Seite in das bestehende Bild unermüdlich und erweitern Sie seine Inhalteund Vielfalt. Verwenden Sie diese Methode, um die Dokumentkomposition zu verbessern undVerwaltung, die eine effiziente Verwaltung von mehrseiten Bildern innerhalb Ihrer Anwendung ermöglicht.
public virtual void AddPage(RasterImage page)
Parameters
page
RasterImage
Die Seite zu hinzufügen.
Exceptions
page’ is null.
AdjustBrightness(Int)
Implementieren brightness’ Anpassung für das Bild, so dass themodifizierung der Gesamtleuchtungsniveaus ermöglicht.Integrieren Sie diese Methode in Ihren Bildverarbeitung Workflow, um die Sichtbarkeit zu verbessern und die visuelle Qualität der Bilder innerhalb Ihrer Anwendung zu verbessern.
public override void AdjustBrightness(int brightness)
Parameters
brightness
int
Brightness Wert ist.
Examples
Im folgenden Beispiel wird die Glanzkorrektur eines TIFF-Bildes durchgeführt.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Set the brightness value. The accepted values of brightness are in the range [-255, 255].
tiffImage.AdjustBrightness(50);
tiffImage.Save(dir + "sample.AdjustBrightness.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustContrast(Flotte)
Verbessern Sie den Kontrast des Aspose.Imaging.Image Beispiel,die Unterschiede zwischen Licht und Dunkelflächen verstärken.Integrieren Sie dieseFunktionalität zur Verbesserung der visuellen Klarheit und der Gesamtqualität des Bildesinnerhalb Ihrer Anforderung.
public override void AdjustContrast(float contrast)
Parameters
contrast
float
Kontrastwert (in Range [-100; 100])
Examples
Im folgenden Beispiel wird eine Kontrastkorrektur eines TIFF-Bildes durchgeführt.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
tiffImage.AdjustContrast(50f);
tiffImage.Save(dir + "sample.AdjustContrast.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustGamma(Flotte)
Anwendung von Gamma Korrektur auf das Bild, die Pixelintensität an diegewünschte Farbbalance.Integrieren Sie diese Methode in Ihre BildverarbeitungArbeitsfluss zur Verbesserung der visuellen Qualität und zur Verbesserung der Genauigkeit der anschließendenAnalyse oder Anzeige von Aufgaben innerhalb Ihrer Anwendung.
public override void AdjustGamma(float gamma)
Parameters
gamma
float
Gamma für rote, grüne und blaue Kanäle Coefficient
Examples
Das folgende Beispiel führt zu einer Gamma Korrektur eines TIFF-Bildes.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Set gamma coefficient for red, green and blue channels.
tiffImage.AdjustGamma(2.5f);
tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AdjustGamma(Flotte, Flotte und Flotte)
Durchführen Sie eine Gamma Korrektur auf dem Bild mit individuellen Koeffizienten für Rot,grüne und blaue Kanäle, die eine feine Anpassung der Farbbalance ermöglichenintegrieren Sie diese Methode in Ihre Bildverarbeitung Pipepräzise Kontrolle über die Farbenrenderung und Verbesserung der visuellen Treue innerhalbIhre Anwendung.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
float
Gamma für den roten Kanalkoeffizient
gammaGreen
float
Gamma für Grünkanalkoeffizient
gammaBlue
float
Gamma für Blue Channel Coefficient
Examples
Das folgende Beispiel führt eine Gamma Korrektur eines TIFF-Bildes durch, das verschiedene Koeffizienten für Farbkomponenten anwendet.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Set individual gamma coefficients for red, green and blue channels.
tiffImage.AdjustGamma(1.5f, 2.5f, 3.5f);
tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
AlignResolutions()
Implementieren der AlignResolutions Helper Methode zur Synchronisierung horizontal undvertikale Auflösungen, die die Einheitlichkeit in Bilddimensionen gewährleisten.Erleichtert gestärktes Bildverarbeitungsprozess durch Harmonisierung der AuflösungParameter, die visuelle Qualität und Konsistenz auf verschiedenen Plattformen optimieren undDie Geräte.
public void AlignResolutions()
BinarizeBradley(Doppelt, Int)
Implementierung von Binarisierung auf dem Bild, das die adaptive Grenzwert von Bradley benutztAlgorithmus mit integrierter Bildgrenzen. Dieser Ansatz dynamisch berechnetLokale Grenzen basierend auf der Nachbarschaft des Bildes, die Anpassungsfähigkeit zuunterschiedliche Bedingungen für die Beleuchtung und eine robuste Segmentation für die anschließendeVerarbeitung von Aufgaben innerhalb Ihrer Anwendung.
public override void BinarizeBradley(double brightnessDifference, int windowSize)
Parameters
brightnessDifference
double
Der Lichtunterschied zwischen Pixel und dem Durchschnitt eines Pixelfensters s x sZentralisieren Sie sich um diesen Pixel.
windowSize
int
Die Größe des s x s Fensters von Pixeln, die um diesen Pixel zentriert sind
Examples
Das folgende Beispiel binarisiert ein TIFF-Bild mit Bradley’s adaptive Frontierung-Algorithmus mit der angegebenen Fenstergröße.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
tiffImage.BinarizeBradley(5, 10);
tiffImage.Save(dir + "sample.BinarizeBradley5_10x10.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeFixed(byte)
Anwendung binarisierung auf das Bild mit einer vordefinierten Grenze, umwandeln Sie es inein binäres Bild mit getrennten Vor- und Hintergrundregionen.Methode in Ihren Bildverarbeitung Workflow zu erleichtern Segmentation und FunktionExtraktions Aufgaben, die Genauigkeit und Effizienz der Bildanalyse innerhalbIhre Anwendung.
public override void BinarizeFixed(byte threshold)
Parameters
threshold
byte
Wenn der entsprechende graue Wert eines Pixels größer ist als der Grenzwert,255 wird dazu zugeordnet, 0 anders.
Examples
Das folgende Beispiel binarisiert ein TIFF-Bild mit der vordefinierten Grenze. binarisierte Bilder enthalten nur 2 Farben - schwarz und wei.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Binarize the image with a threshold value of 127.
// If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
tiffImage.BinarizeFixed(127);
tiffImage.Save(dir + "sample.BinarizeFixed.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
BinarizeOtsu()
Verwenden Sie die Otsu-Grenze, um die Binarisierung auf dem Bild automatisch durchzuführendie optimale Grenzwerte auf der Grundlage des Histogramms des Bildes bestimmen.diese Methode in Ihren Bildverarbeitung Workflow, um eine effektive Segmentation zu erzielenund Funktionsextraction, die Genauigkeit und Zuverlässigkeit der Bildanalyse verbessernAufgaben innerhalb Ihrer Anwendung.
public override void BinarizeOtsu()
Examples
Das folgende Beispiel binarisiert ein TIFF-Bild mit Otsu-Grenze. binarisierte Bilder enthalten nur 2 Farben - schwarz und wei.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Binarize the image with Otsu thresholding.
tiffImage.BinarizeOtsu();
tiffImage.Save(dir + "sample.BinarizeOtsu.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Crop(Rectangle)
Pflanzen Sie das Bild mit einer angegebenen rechteckigen Region, die eine genaue Auswahl derdie gewünschte Inhalte.Integrieren Sie diese Methode in Ihren Bildverarbeitung Workfloweffizient unerwünschte Bereiche entfernen und sich auf wesentliche Details konzentrieren, dieGanzes Klarheit und Zusammensetzung des Bildes.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
Die rechte Ecke.
Examples
Das folgende Beispiel erzeugt ein TIFF-Bild. Die Erntefläche wird über Aspose.Imaging.Rectangle angegeben.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Crop the image. The cropping area is the rectangular central area of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(tiffImage.Width / 4, tiffImage.Height / 4, tiffImage.Width / 2, tiffImage.Height / 2);
tiffImage.Crop(area);
// Save the cropped image to PNG
tiffImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Crop(Int, int, int, int)
Durchführen Sie die Schraubung auf dem Bild, indem Sie Schwankungen auf der linken, rechten, oberen undDiese Methode ermöglicht die genaue Auswahl der gewünschten Portion vonBild, die eine effiziente Entfernung von unerwünschten Bereichen erleichtert und sich aufEssentielle Inhalte.Integrieren Sie diese Funktionalität in Ihre BildverarbeitungPipeline zur Verbesserung der Klarheit und Zusammensetzung nach Bedarf innerhalb Ihrer Anwendung.
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
int
Die Linke wechseln.
rightShift
int
Der richtige Wandel.
topShift
int
Der Top Shift.
bottomShift
int
Der unteren Wandel.
Examples
Das folgende Beispiel erzeugt ein TIFF-Bild. Die Erntefläche wird über die linken, oberen, rechten, unteren Margen angegeben.
string dir = @"c:\temp\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Crop again. Set a margin of 10% of the image size.
int horizontalMargin = tiffImage.Width / 10;
int verticalMargin = tiffImage.Height / 10;
tiffImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);
// Save the cropped image to PNG.
tiffImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Dither(DitheringMethod, int, IColorPalette)
Durchführen Sie die Dithering auf dem aktuellen Bild, um seine visuelle Qualität zu verbessern und zu reduzierenFarbverbindungsartifakte.Integrieren Sie diese Methode in Ihren Bildverarbeitung Workflowum glattere Übergänge zwischen den Farben zu gewährleisten, was zu einer besseren Gesamtbilde führtAussehen und Klarheit.
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethod
Die Dithering Methode.
bitsCount
int
Die letzten Bits zählen für Dithering.
customPalette
IColorPalette
Die gewöhnliche Palette für Dithering.
Examples
Das folgende Beispiel laden ein TIFF-Bild auf und führt mit unterschiedlichen Palettentiefen die Grenz- und Flöde-Dithering durch.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Perform threshold dithering using 4-bit color palette which contains 16 colors.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
tiffImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4, null);
tiffImage.Save(dir + "sample.ThresholdDithering4.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
tiffImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1, null);
tiffImage.Save(dir + "sample.FloydSteinbergDithering1.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Filter(Rectangle, FilterOptionsBase)
Filtern Sie die Inhalte innerhalb des angegebenen Rechteckens, indem Sie ein angegebenes Bild anwendenVerarbeitungsfilter zur Verbesserung oder Änderung der ausgewählten Region.in Ihren Image-Manipulation-Workfluss, um gezielte Verbesserungen zu erreichen oderTransformationen innerhalb Ihrer Anwendung.
public override void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
Rectangle
Die rechte Ecke.
options
FilterOptionsBase
Die Optionen.
Examples
Das folgende Beispiel gilt für verschiedene Arten von Filtern für ein TIFF-Bild.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a median filter with a rectangle size of 5 to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
tiffImage.Save(dir + "sample.MedianFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
tiffImage.Save(dir + "sample.BilateralSmoothingFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
tiffImage.Save(dir + "sample.GaussianBlurFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
tiffImage.Save(dir + "sample.GaussWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
tiffImage.Save(dir + "sample.MotionWienerFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
tiffImage.Filter(tiffImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
tiffImage.Save(dir + "sample.SharpenFilter.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
GetOriginalOptions()
Retrieve Optionen, die aus den ursprünglichen Datei-Einstellungen abgeleitet werden, die Seamless erleichterndie Erhaltung von Schlüsselparameter wie Bit-Dichte und sonstigen wesentlichen AttributeVerwenden Sie diese Methode, um Treue und Konsistenz inBildverarbeitung Aufgaben, optimale Ergebnisse ohne unnötige Änderungen zu gewährleisten.Zum Beispiel, wenn wir ein schwarz-weißes PNG-Bild mit 1 Bit pro Pixel laden und es dann mit derAspose.Imaging.DataStreamSupporter.Save(System.String) Methode, wird das Ausgang PNG Bild mit 8-Bit pro Pixel produziert.Um es zu vermeiden und PNG-Bild mit 1 Bit pro Pixel zu speichern, verwenden Sie diese Methode, um die entsprechenden Speicheroptionen zu erhalten und sie durchzuführen.auf die Aspose.Imaging.Image.Save(System.String,Aspose.Imaging.ImageOptionsBase) Methode als den zweiten Parameter.
public override ImageOptionsBase GetOriginalOptions()
Returns
Die Optionen basieren auf den ursprünglichen Dateiinstellungen.
Exceptions
Es gibt keine ursprünglichen Optionen, die aus dem Bild extrahiert werden können
Grayscale()
Umwandeln Sie das Bild in seine grayscale Darstellung, umwandeln Sie es in eineEinkanalbild, in dem jedes Pixel die Intensität darstellt.in Ihre Bildverarbeitung Pipe, um die Analyse zu vereinfachen und zu verbessernKompatibilität mit grayscale-basierten Algorithmen, die verschiedene Computer erleichternVision- und Bildanalyse Aufgaben innerhalb Ihrer Anwendung.
public override void Grayscale()
Examples
Das folgende Beispiel verwandelt ein farbiges TIFF-Bild in seine grayscale-Repräsentation. Grayscale-Bildungen bestehen ausschließlich aus grauen Schatten und tragen nur Intensitätsinformationen.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
tiffImage.Grayscale();
tiffImage.Save(dir + "sample.Grayscale.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
InsertFrame(mit TiffFrame)
Einfügen Sie das neue Rahmen in den angegebenen Index innerhalb der Frame-Sequenz und stellen Sie sicher, dasspräzise Kontrolle über die Rahmenordnung. Verwenden Sie diese Methode, um das Rahmen zu verwaltenSequenzen effizient, die dynamische Manipulation und Organisation des Bildes erleichtertInhalte innerhalb Ihrer Anwendung.
public void InsertFrame(int index, TiffFrame frameToInsert)
Parameters
index
int
Index des neuen Frames in der Frame-Liste
frameToInsert
TiffFrame
Das Frame zum Einfügen.
NormalizeAngle(Bool, Farbe)
Verwenden Sie die NormalizeAngle-Methode, die speziell für geschkante Textdokumente entworfen wurdezu korrigieren geschweißte Scans, sorgt für eine genaue Anpassung.integrieren Sie diese Funktionalität in Ihre Textverarbeitung Workflows zu verbessernLesbarkeit und Qualität des Dokuments, Verbesserung der allgemeinen Effizienz in der Texterkennungund analytische Aufgaben.Diese Methode verwendet Aspose.Imaging.RasterImage.GetSkewAngle und Aspose.Imaging.FileFormats.Tiff.TiffImage.Rotate(System.Single,System.Boolean,Aspose.Imaging.Color) Methoden.
public override void NormalizeAngle(bool resizeProportionally, Color backgroundColor)
Parameters
resizeProportionally
bool
Wenn Sie auf “richtig” festgelegt sind, werden Sie Ihre Bildgröße gemäß rotierten Rechtangeln (Kornpunkte) Prognosen geändert haben, in anderen Fällen, die Dimensionen unberührt lassen und nur interne Bildgehalte rotierten.
backgroundColor
Color
Farbe des Hintergrunds.
ReleaseManagedResources()
Stellen Sie sicher, dass hier keine nicht verwalteten Ressourcen veröffentlicht werden, da sie möglicherweise bereits veröffentlicht wurden.
protected override void ReleaseManagedResources()
RemoveFrame(Int)
unmöglich beseitigen Sie das durch seinen Index identifizierte Rahmen aus der Bildsequenz,Frame Management im Rahmen Ihrer Anwendung.Integrieren Sie diesFunktionalität zur Verbesserung der Effizienz und Präzision in der Rahmenmanipulation,Erleichterung der unberührten Organisation und Präsentation von Bildgehalt.
public TiffFrame RemoveFrame(int index)
Parameters
index
int
Index der Frame zu entfernen.
Returns
Das entfernte Rahmen.
Examples
Das folgende Beispiel zeigt, wie man ein TIFF-Mutlipage aus einzelnen Rasterbildern zusammensetzt.
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// This is Font and Brush for drawing text on individual frames.
Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
// Create 5 frames
for (int i = 1; i <= 5; i++)
{
Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
// Create a PNG image and draw the number of page on it.
Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
gr.DrawString(i.ToString(), font, brush, 10, 10);
// Create a frame based on the PNG image.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
// Add the frame to the TIFF image.
tiffImage.AddFrame(frame);
}
// The image was created with a single default frame. Let's remove it.
Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
tiffImage.ActiveFrame = tiffImage.Frames[1];
tiffImage.RemoveFrame(0);
// Don't forget to dispose the frame if you won't add it to some other TiffImage
activeFrame.Dispose();
tiffImage.Save();
}
Remarks
Hinweis: Vergessen Sie nicht, den Rahmen aufzustellen, wenn Sie ihn nicht zu anderen TiffImage hinzufügen.
RemoveFrame(TiffFrame)
Effiziente Entfernung des angegebenen Frames aus der Bildsequenz, diegestärktes Rahmenmanagement innerhalb Ihrer Anwendung.Integrieren Sie diese Funktionalitätzur Erhöhung der Genauigkeit und Flexibilität bei der Rahmenmanipulation und zur Gewährleistung des SeamlessOrganisation und Präsentation von Bildgehalt.
public void RemoveFrame(TiffFrame frame)
Parameters
frame
TiffFrame
Der Rahmen zu entfernen.
Remarks
Hinweis: Vergessen Sie nicht, den Rahmen aufzustellen, wenn Sie ihn nicht zu anderen TiffImage hinzufügen.
RemoveMetadata()
Remove this image instance metadata by setting this Aspose.Imaging.xmp.IHasXmpData.XmPdata and Aspos.Exif.ihasExivDate. Null.
public override void RemoveMetadata()
ReplaceFrame(mit TiffFrame)
ersetzen Sie den Rahmen an der angegebenen Position mit einem anderen Rahmen unbeweglich,die dynamische Rahmenmanagement innerhalb der Bildsequenz erleichtern.Methode zur Verbesserung der Flexibilität und Genauigkeit bei der Rahmenmanipulation,Optimale Organisation und Präsentation von Image-Inhalt innerhalb Ihrer Anwendung.
public TiffFrame ReplaceFrame(int index, TiffFrame frameToReplace)
Parameters
index
int
Die nullbasierte Frame Position.
frameToReplace
TiffFrame
Der Rahmen zu ersetzen.
Returns
Das entfernte Rahmen.
Remarks
Hinweis: Vergessen Sie nicht, den Rahmen aufzustellen, wenn Sie ihn nicht zu anderen TiffImage hinzufügen.
Resize(int, int, ResizeType)
Wiederherstellen des Bildes nach einem angegebenen Wiederherstellungstyp, so dass es flexibel istAnpassung der Bilddimensionen während der Erhaltung des Aspektverhältnisses oder der Anwendung spezifischerSkalierung Algorithmen.Integrieren Sie diese Methode in Ihren Bildverarbeitung Workflowum eine genaue Kontrolle über die Wiederherstellung von Transaktionen innerhalb Ihrer Anwendung zu erreichen.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
Die neue Breite.
newHeight
int
Die neue Höhe.
resizeType
ResizeType
Die Resize Art.
Examples
Dieses Beispiel laden ein TIFF-Bild auf und resisiert es mit verschiedenen Resisierungsmethoden.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Bilinear resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Bilinear resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Resize(int, int, ImageResizeSettings)
Anpassung der Größe des Bildes auf der Grundlage der angegebenen Einstellungen, so dass präziseKontrolle über Dimensionen, Aspektverhältnis und Skalierungsverhalten.Methode in Ihren Bildverarbeitungswerkfluss, um eine angepasste Wiederherstellung zu erzielenAktivitäten, die an die spezifischen Anforderungen Ihrer Anfrage angepasst sind.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
Die neue Breite.
newHeight
int
Die neue Höhe.
settings
ImageResizeSettings
Die Resize Einstellungen.
Examples
Dieses Beispiel laden ein TIFF-Bild auf und resiziert es mit verschiedenen Resizing-Einstellungen.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();
// The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;
// The small rectangular filter
resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;
// The number of colors in the palette.
resizeSettings.EntriesCount = 256;
// The color quantization is not used
resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;
// The euclidian method
resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;
using (Aspose.Imaging.Image image = (Aspose.Imaging.Image)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Scale down by 2 times using adaptive resampling.
tiffImage.Resize(image.Width / 2, image.Height / 2, resizeSettings);
// Save to PNG
tiffImage.Save(dir + "downsample.adaptive.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ResizeHeightProportionally(Rückschlag, Rückschlag)
Durchführen Sie eine verhältnismäßige Anpassung der Bildhöhe und bewahren Sie ihr AspektVerhältnis für eine konsistente visuelle Integrität. Verwenden Sie diese Methode, um dynamisch umzusetzenBilder innerhalb Ihrer Anwendung, optimale Anzeige auf verschiedenen Plattformen zu gewährleistenund Geräte, ohne die Qualität des Inhalts zu beeinträchtigen.
public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)
Parameters
newHeight
int
Die neue Höhe.
resizeType
ResizeType
Typ der Resize.
Examples
Dieses Beispiel laden ein TIFF-Bild auf und resiziert es verhältnismäßig mit verschiedenen Resizierungsmethoden. Nur die Höhe wird angegeben, die Breite wird automatisch berechnet.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Bilinear resampling.
image.ResizeHeightProportionally(image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Bilinear resampling.
image.ResizeHeightProportionally(image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
ResizeProportional(int, int, ResizeType)
Durchführen Sie eine verhältnismäßige Resize-Aktion auf dem Bild, bewahren Sie seinen Aspekt Ratiowhile und justieren Sie seine Dimensionen. Verwenden Sie diese Methode, um die Bilder dynamisch zu skalierenIn Ihrer Anwendung, um eine konsistente visuelle Darstellung der Inhaltsintegrität zu gewährleisten.Die verhältnismäßige Resize wird jedes Rahmen nach dem Verhältnis von newWidth’/width und
newHeight’/height resize.
public void ResizeProportional(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
Die neue Breite.
newHeight
int
Die neue Höhe.
resizeType
ResizeType
Die Resize Art.
ResizeWidthProportionally(Rückschlag, Rückschlag)
Anpassung der Breite des Bildes während der Aufrechterhaltung des Aspektverhältnisses,Verhältnismäßige Rezension für eine optimale visuelle Präsentation. Verwenden Sie diese Methodedynamische Bildskala innerhalb Ihrer Anwendung, die eine konsistente undsthetisch angenehmer Rendering über verschiedene Displaykontexte.
public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)
Parameters
newWidth
int
Die neue Breite.
resizeType
ResizeType
Typ der Resize.
Examples
Dieses Beispiel laden ein TIFF-Bild auf und resiziert es verhältnismäßig mit verschiedenen Resizierungsmethoden. Nur die Breite wird angegeben, die Höhe wird automatisch berechnet.
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale up by 2 times using Bilinear resampling.
image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
// Scale down by 2 times using Bilinear resampling.
image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with the default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
Rotate(Float, Bool, Farbe)
Drehen Sie das Bild um seinen zentralen Punkt mit einem angegebenen Winkel, so dass präziseOrientierungseinstellungen.Integrieren Sie diese Funktionalität in Ihre BildverarbeitungPipeline, um genaue Transformationen zu erleichtern, eine optimale Anpassung zu gewährleisten undDarstellung visueller Inhalte innerhalb Ihrer Anwendung.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
Der Rotationswinkel in Grad. Positive Werte werden die Uhr drehen.
resizeProportionally
bool
Wenn Sie auf “richtig” festgelegt sind, werden Sie Ihre Bildgröße gemäß rotierten Rechtangeln (Kornpunkte) Prognosen geändert haben, in anderen Fällen, die Dimensionen unberührt lassen und nur interne Bildgehalte rotierten.
backgroundColor
Color
Farbe des Hintergrunds.
Examples
Das folgende Beispiel zeigt, wie man ein TIFF-Bild um das Zentrum mit 45 Grad Uhrwinkel dreht.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Create a permanent, not temporary file source.
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "rotated.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// The linear gradient from the left-top to the right-bottom corner of the image.
Aspose.Imaging.Brushes.LinearGradientBrush brush =
new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green);
// Fill the active frame with the linear gradient brush.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage);
gr.FillRectangle(brush, tiffImage.Bounds);
// Rotate the image around the center by 45 degrees clockwise.
// The image size changed according to rotated rectangle (corner points).
tiffImage.Rotate(45f, true, Aspose.Imaging.Color.Black);
tiffImage.Save();
// Rotate the image around the center by 45 degrees clockwise.
// Leave the image dimensions untouched and only the internal image content are rotated.
tiffImage.Rotate(45f, false, Aspose.Imaging.Color.Gray);
tiffImage.Save(dir + "rotated.preservesize.tif");
}
RotateFlip(RotateFlipType)
Durchführen Sie Rotation, Flipping oder eine Kombination beider Operationen ausschließlich auf derDiese Methode ermöglicht eine genaue Manipulation einzelner Frame innerhalbdie Bildsequenz, die Flexibilität bei Bildbearbeitung und Zusammensetzung innerhalbIhre Anwendung.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
Der Rotate Flip Typ.
Examples
Dieses Beispiel ladet ein TIFF-Bild, dreht es um 90 Grad Uhr und flipt optionell das Bild horizontaler und/oder vertikalerweise.
string dir = "c:\\temp\\";
Aspose.Imaging.RotateFlipType[] rotateFlipTypes = new Aspose.Imaging.RotateFlipType[]
{
Aspose.Imaging.RotateFlipType.Rotate90FlipNone,
Aspose.Imaging.RotateFlipType.Rotate90FlipX,
Aspose.Imaging.RotateFlipType.Rotate90FlipXY,
Aspose.Imaging.RotateFlipType.Rotate90FlipY,
};
foreach (Aspose.Imaging.RotateFlipType rotateFlipType in rotateFlipTypes)
{
// Rotate, flip and save to the output file.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
image.RotateFlip(rotateFlipType);
image.Save(dir + "sample." + rotateFlipType + ".png", new Aspose.Imaging.ImageOptions.PngOptions());
}
}
SaveData(Stream)
Speichert die Daten des Objekts in den angegebenen Strom.
protected override void SaveData(Stream stream)
Parameters
stream
Stream
Der Strom, um die Daten des Objekts zu speichern.
SetResolution(Doppel, Doppel)
Erstellt die Auflösung für die angegebenen Aspose.Imaging.RasterImage, ermöglichtpräzise Kontrolle über Bilder rendering und Display Eigenschaften. integrieren Sie dieseFunktionalität, um die visuelle Ausgabe zu optimieren und die Kompatibilität mit verschiedenenProduktionsgeräte und Plattformen, die die allgemeine Benutzererfahrung verbessern.
public override void SetResolution(double dpiX, double dpiY)
Parameters
dpiX
double
Die horizontale Auflösung, in Punkten pro Zoll, des Aspose.Imaging.RasterImage.
dpiY
double
Die vertikale Auflösung, in Punkten pro Zoll, des Aspose.Imaging.RasterImage.
Examples
Das folgende Beispiel zeigt, wie man eine horizontale/vertikale Auflösung eines TIFF-Bildes festlegt.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// Get horizontal and vertical resolution of the TiffImage.
double horizontalResolution = tiffImage.HorizontalResolution;
double verticalResolution = tiffImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
tiffImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", tiffImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", tiffImage.VerticalResolution);
}
}
UpdateDimensions(und int, int)
Aktualisieren Sie die Bilddimensionen.
protected override void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
Die neue Bildweite.
newHeight
int
Die neue Bildhöhe.