Class TiffImage

Class TiffImage

Tên không gian: Aspose.Imaging.FileFormats.Tiff Tổng hợp: Aspose.Imaging.dll (25.4.0)

Process Tagged Image File Format (TIFF) raster hình ảnh với API của chúng tôi, cung cấpHỗ trợ toàn diện cho các giải pháp khác nhau và khả năng chỉnh sửa nâng caonhư xử lý dữ liệu EXIF và các kênh alpha. bình thường hóa góc cho hình ảnh quét,Đổi lại, chuyển đổi thành grayscale, và áp dụng bộ lọc, sửa đổi gamma và hình ảnhđiều chỉnh các thông số một cách dễ dàng. xử lý các tệp TIFF đa khung,Tạo các con đường đồ họa, thêm hình dạng, và dễ dàng lưu các hình ảnh vào các định dạng khác nhau.

[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

BigTiffImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IMultipageImageExt , IMultipageImage , IHasExifData , IHasXmpData , IHasMetadata

Thành viên thừa kế

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

Tạo đồ họa từ Path Resources trong hình ảnh TIFF.

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");
                                                                  }

Tạo Path Resources bằng cách sử dụng Graphics.

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 &lt; coordinates.Length; coordinateIndex += 2)
                                                             for (var index = 0; index &lt; 3; index++)
                                                                 yield return new PointF(coordinates[coordinateIndex], coordinates[coordinateIndex + 1]);
                                                     }</pointf></pathresource>

Constructors

TiffImage(TiffFrame)

Bắt đầu một đối tượng mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffImage, xác địnhparameter frame.Constructor này giúp tạo ra một TiffImageVí dụ, cho phép các nhà phát triển xác định khung để được tải hoặc xử lý,làm đơn giản hóa các nhiệm vụ xử lý hình ảnh của Tiff trong ứng dụng của họ.

public TiffImage(TiffFrame frame)

Parameters

frame TiffFrame

Màn hình tiff để bắt đầu hình ảnh với.

Examples

Ví dụ này cho thấy làm thế nào để tạo một hình ảnh TIFF từ scratch và lưu nó vào một tệp.

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

ArgumentNullException

Tiff frame’ không thể trống rỗng

TiffImage(TiffFrame[])

Tạo một ví dụ mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffImage, cung cấp một danh sách cáckhung như một thông số. nhà xây dựng này cho phép khởi động một TiffImageđối tượng với nhiều khung, tạo điều kiện cho việc xử lý hiệu quả vàTIFF hình ảnh theo dõi trong các ứng dụng phần mềm.

public TiffImage(TiffFrame[] frames)

Parameters

frames TiffFrame [ ]

Các khung

Examples

Ví dụ này cho thấy làm thế nào để tạo một hình ảnh TIFF với 2 khung và lưu nó vào một tệp.

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

ArgumentNullException

khung frame

Properties

ActiveFrame

Quản lý khung hoạt động một cách an toàn, tạo điều kiện cho việc di chuyển năng động vàthao tác trong bối cảnh được chỉ định. Khả năng ứng dụng của bạn để tương táchiệu quả với nội dung đa phương tiện, tăng sự tham gia của người dùng và năng suất.

public TiffFrame ActiveFrame { get; set; }

Giá trị bất động sản

TiffFrame

Examples

Ví dụ sau đây cho thấy làm thế nào để tạo thành một TIFF mutlipage từ các hình ảnh raster cá nhân.

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 &lt;= 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

Kết hợp lệnh byte cho tệp TIFF một cách an toàn, đảm bảo kiểm soát chính xácgiải thích dữ liệu. Khả năng ứng dụng của bạn với sự linh hoạt để thích ứng vớiđịnh dạng tệp khác nhau, tăng khả năng tương thích và hiệu quả trong việc xử lý dữ liệu.

public TiffByteOrder ByteOrder { get; set; }

Giá trị bất động sản

TiffByteOrder

ExifData

Truy cập hoặc sửa đổi dữ liệu EXIF liên quan đến khung hoạt động một cách vô hình, cho phépkiểm soát chính xác dữ liệu hình ảnh. nâng cao khả năng của ứng dụng của bạn bằng cáchtích hợp tính năng này, đảm bảo việc bảo tồn và tùy chỉnh chính xác củaThông tin hình ảnh cần thiết.

public ExifData ExifData { get; set; }

Giá trị bất động sản

ExifData

FileFormat

Khôi phục giá trị định dạng tệp liên quan đến hình ảnh. thuộc tính này phục vụ nhưmột khía cạnh quan trọng của thu thập dữ liệu hình ảnh, cho phép các ứng dụng phần mềm đểxác định và giải thích định dạng của dữ liệu hình ảnh một cách hiệu quả.

public override FileFormat FileFormat { get; }

Giá trị bất động sản

FileFormat

Frames

Khôi phục một loạt các ví dụ Aspose.Imaging.FileFormats.Tiff. TiffFrame, cho phép toàn diệntruy cập và thao túng các khung cá nhân trong hình ảnh TIFF.năng lượng của bộ điều khiển này để làm nhanh các dòng công việc xử lý hình ảnh, đảm bảo độ chính xácKiểm soát và tối ưu hóa nội dung thị giác.

public TiffFrame[] Frames { get; }

Giá trị bất động sản

TiffFrame [ ]

Examples

Ví dụ sau đây cho thấy làm thế nào để tạo thành một TIFF mutlipage từ các hình ảnh raster cá nhân.

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 &lt;= 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

Xác định xem hình ảnh có một kênh alpha hay không, cung cấp thông tin quan trọngcho các hoạt động rendering và compositing. tích hợp tính năng này để tối ưu hóacác dòng công việc xử lý thị giác, đảm bảo sự đại diện và thao tác chính xác củaCác yếu tố minh bạch

public override bool HasAlpha { get; }

Giá trị bất động sản

bool

Examples

Ví dụ sau đây tải một hình ảnh TIFF và in thông tin về định dạng dữ liệu thô và kênh alpha.

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

Khôi phục độ phân giải ngang của Aspose.Imaging.Ảnh trong pixelmỗi inch, tạo điều chỉnh chính xác và khả năng rendering.metadata hình ảnh thiết yếu mà không cố gắng, tạo ra khả năng xử lý ảnh nhanh chóngdòng công việc cho trải nghiệm người dùng nâng cao.

public override double HorizontalResolution { get; set; }

Giá trị bất động sản

double

Examples

Ví dụ sau đây cho thấy làm thế nào để thiết lập độ phân giải horizontal/vertical của một hình ảnh TIFF.

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

Ghi chú theo mặc định giá trị này luôn 96 vì các nền tảng khác nhau không thể trả lại độ phân giải màn hình. Bạn có thể xem xét sử dụng phương pháp SetResolution để cập nhật cả hai giá trị độ phân giải trong một cuộc gọi.

PageCount

Đặt lại tổng số trang trong tài liệu cụ thể, tạo điều kiệnhiệu quả điều hướng và quản lý nội dung đa trang. bao gồm điều nàychức năng để cải thiện trải nghiệm người dùng, cho phép truy cập không ngừngcấu trúc tài liệu toàn diện.

public override int PageCount { get; }

Giá trị bất động sản

int

Pages

Truy cập các trang của tài liệu một cách an toàn, cho phép di chuyển năng động vàthao tác trong cấu trúc nội dung.Tăng cường ứng dụng của bạn với hiệu quảtruy cập vào các trang cá nhân, tạo điều kiện cho việc xử lý tài liệu nhanh chóng vàTăng cường tương tác người dùng.

public override Image[] Pages { get; }

Giá trị bất động sản

Image [ ]

PremultiplyComponents

Chỉ định nếu các thành phần cần quá nhiều, đảm bảo xử lý hiệu quảcác yếu tố thị giác. cải thiện các quá trình rendering bằng cách thu thập tài sản này,Tối ưu hóa dòng công việc đồ họa cho hiệu suất tối ưu.

public override bool PremultiplyComponents { get; set; }

Giá trị bất động sản

bool

Examples

Ví dụ sau đây tạo ra một hình ảnh TIFF mới, tiết kiệm các pixel bán minh bạch được chỉ định, sau đó tải các pixels đó và nhận được màu sắc cuối cùng trong hình thức quá nhiều.

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 &lt; 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

Truy cập độ phân giải dọc của Aspose.Imaging.Image in pixels perinch, cho phép điều chỉnh chính xác và thực hiện tối ưu hóa.dữ liệu hình ảnh một cách nhanh chóng để đồng bộ hóa các dòng công việc xử lý ảnh, đảm bảoChất lượng và hiệu suất cao hơn trong ứng dụng của bạn.

public override double VerticalResolution { get; set; }

Giá trị bất động sản

double

Examples

Ví dụ sau đây cho thấy làm thế nào để thiết lập độ phân giải horizontal/vertical của một hình ảnh TIFF.

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

Ghi chú theo mặc định giá trị này luôn 96 vì các nền tảng khác nhau không thể trả lại độ phân giải màn hình. Bạn có thể xem xét sử dụng phương pháp SetResolution để cập nhật cả hai giá trị độ phân giải trong một cuộc gọi.

Methods

Add(TiffImage)

Thêm các khung từ hình ảnh được chỉ định một cách không rắc rối vào khuôn khổ hiện tại,củng cố nội dung của họ và nâng cao tính linh hoạt thành phần.phương pháp này để nhanh chóng quản lý khung và thao túng trongứng dụng, tạo điều kiện xử lý hiệu quả của hình ảnh đa khung.

public void Add(TiffImage image)

Parameters

image TiffImage

Nguồn hình ảnh

AddFrame(TiffFrame)

Nhúng khung cụ thể một cách không thấm vào hình ảnh, mở rộng nội dung của nóSử dụng phương pháp này để cải thiện thành phần và quản lý hình ảnh,Khả năng xử lý hiệu quả của hình ảnh đa khung trong ứng dụng của bạn.

public void AddFrame(TiffFrame frame)

Parameters

frame TiffFrame

khung để thêm.

Examples

Ví dụ sau đây cho thấy làm thế nào để tạo thành một TIFF mutlipage từ các hình ảnh raster cá nhân.

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 &lt;= 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[])

Kết hợp hàng rào các khung một cách không ngừng vào hình ảnh, làm giàu nội dung của nó vàđa dạng. sử dụng phương pháp này để cải thiện thành phần và quản lý hình ảnh,cho phép xử lý hiệu quả của hình ảnh đa khung trong ứng dụng của bạn.

public void AddFrames(TiffFrame[] frames)

Parameters

frames TiffFrame [ ]

Các khung ra để thêm

AddPage(RasterImage)

Thêm một trang mới vào hình ảnh hiện có một cách không ngừng, mở rộng nội dung của nóvà đa dạng. sử dụng phương pháp này để cải thiện thành phần tài liệu vàquản lý, cho phép xử lý hiệu quả của hình ảnh nhiều trang trong ứng dụng của bạn.

public virtual void AddPage(RasterImage page)

Parameters

page RasterImage

Trang để thêm.

Exceptions

ArgumentNullException

page’ is null.

AdjustBrightness(int)

Thực hiện điều chỉnh brightness’ cho hình ảnh, cho phép themodification của mức độ chiếu sáng tổng thể. Tham gia phương pháp này vào lưu lượng công việc xử lý ảnh của bạn để tăng khả năng hiển thị và cải thiện chất lượng hình dạng trong ứng dụng.

public override void AdjustBrightness(int brightness)

Parameters

brightness int

Giá trị ánh sáng

Examples

Ví dụ sau đây thực hiện điều chỉnh độ sáng của một hình ảnh TIFF.

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(Sông)

Tăng độ tương phản của Aspose.Imaging.Image instance,tăng sự khác biệt giữa các khu vực ánh sáng và bóng tối của nó.chức năng để cải thiện độ sáng thị giác và chất lượng tổng thể của hình ảnhtrong ứng dụng của bạn.

public override void AdjustContrast(float contrast)

Parameters

contrast float

Giá trị tương phản (trong phạm vi [-100; 100])

Examples

Ví dụ sau đây thực hiện điều chỉnh tương phản của một hình ảnh TIFF.

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(Sông)

Ứng dụng chỉnh sửa gamma vào hình ảnh, điều chỉnh cường độ pixel để đạt đượccân bằng màu mong muốn. Tham gia phương pháp này vào xử lý hình ảnh của bạndòng công việc để nâng cao chất lượng thị giác và cải thiện độ chính xác củaphân tích hoặc hiển thị các nhiệm vụ trong ứng dụng của bạn.

public override void AdjustGamma(float gamma)

Parameters

gamma float

Gamma cho các kênh đỏ, xanh và xanh coefficient

Examples

Ví dụ sau đây thực hiện chỉnh sửa gamma của một hình ảnh TIFF.

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(float, float và float)

Thực hiện chỉnh sửa gamma trên hình ảnh bằng cách sử dụng các coefficients riêng cho màu đỏ,xanh và kênh xanh, cho phép điều chỉnh cân bằng màu sắc phù hợptích hợp phương pháp này vào đường ống xử lý hình ảnh của bạn đểđảm bảo kiểm soát chính xác về rendering màu sắc và tăng độ trung thành thị giác trongứng dụng của bạn.

public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)

Parameters

gammaRed float

Gamma cho Red Channel Coefficient

gammaGreen float

Gamma cho Green Channel Coefficient

gammaBlue float

Gamma cho Blue Channel Coefficient

Examples

Ví dụ sau đây thực hiện chỉnh sửa gamma của một hình ảnh TIFF áp dụng các đồng bộ khác nhau cho các thành phần màu.

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()

Thực hiện phương pháp AlignResolutions giúp đồng bộ ngang vàđộ phân giải dọc, đảm bảo sự đồng nhất trong kích thước hình ảnh. chức năng nàytạo thuận lợi cho các dòng công việc xử lý hình ảnh bằng cách phối hợp độ phân giảicác thông số, tối ưu hóa chất lượng hình ảnh và sự nhất quán trên các nền tảng khác nhau vàThiết bị

public void AlignResolutions()

BinarizeBradley(Đôi, int)

Thực hiện sự nhị phân hóa trên hình ảnh sử dụng giới hạn thích ứng của Bradleyalgorithm with integral image thresholding. phương pháp này tính toán năng độnggiới hạn địa phương dựa trên khu vực của hình ảnh, tăng khả năng thích ứng vớiđiều kiện chiếu sáng khác nhau và đảm bảo phân khúc vững chắc cho sau đóxử lý các nhiệm vụ trong ứng dụng của bạn.

public override void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

Sự khác biệt độ sáng giữa pixel và trung bình của một s x s cửa sổ của pixelstập trung xung quanh pixel này.

windowSize int

Kích thước của s x s cửa sổ của các pixel tập trung xung quanh pixel này

Examples

Ví dụ sau đây nhị phân một hình ảnh TIFF với thuật toán giới hạn thích ứng của Bradley với kích thước cửa sổ được chỉ định.

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)

Ứng dụng nhị phân hóa vào hình ảnh bằng cách sử dụng một giới hạn được xác định trước, chuyển đổi nó thànhmột hình ảnh nhị phân với các khu vực phía trước và nền khác nhau.phương pháp vào dòng công việc xử lý hình ảnh của bạn để tạo điều kiện phân khúc và tính năngnhiệm vụ khai thác, tăng độ chính xác và hiệu quả của phân tích hình ảnh trongứng dụng của bạn.

public override void BinarizeFixed(byte threshold)

Parameters

threshold byte

Giá trị ranh giới: Nếu giá trị màu xám tương ứng của một pixel lớn hơn so với giới hạn, một255 sẽ được phân bổ cho nó, 0 khác.

Examples

Ví dụ sau đây nhị phân một hình ảnh TIFF với ranh giới được xác định trước. Hình ảnh binary chỉ chứa 2 màu - đen và trắng.

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()

Sử dụng ranh giới Otsu để thực hiện nhị phân trên hình ảnh, tự độngxác định giá trị giới hạn tối ưu dựa trên histogram của hình ảnh.phương pháp này vào dòng công việc xử lý hình ảnh của bạn để đạt được phân khúc hiệu quảvà tính năng khai thác, tăng độ chính xác và độ tin cậy của phân tích hình ảnhCác nhiệm vụ trong ứng dụng của bạn.

public override void BinarizeOtsu()

Examples

Ví dụ sau đây nhị phân một hình ảnh TIFF với Otsu thang. Hình ảnh nhí chứa chỉ 2 màu - đen và trắng.

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)

trồng hình ảnh bằng cách sử dụng một khu vực thẳng cụ thể, cho phép lựa chọn chính xác củatích hợp phương pháp này vào dòng công việc xử lý hình ảnh của bạn đểhiệu quả loại bỏ các khu vực không mong muốn và tập trung vào các chi tiết cần thiết, tăng cườngSự rõ ràng tổng thể và thành phần của hình ảnh.

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

Vòng thẳng.

Examples

Ví dụ sau đây trồng một hình ảnh TIFF. Khu vực trồng được chỉ định thông qua Aspose.Imaging.Rectangle.

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, int)

Thực hiện khoan trên hình ảnh bằng cách chỉ định các chuyển đổi ở bên trái, bên phải, trên, vàphương pháp này cho phép lựa chọn chính xác của phần mong muốn củahình ảnh, tạo điều kiện để loại bỏ hiệu quả các khu vực không mong muốn và tập trung vàonội dung thiết yếu. tích hợp chức năng này vào xử lý hình ảnh của bạnđường ống để tăng độ rõ ràng và thành phần cần thiết trong ứng dụng của bạn.

public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)

Parameters

leftShift int

bên trái thay đổi.

rightShift int

Chuyển đổi đúng

topShift int

Thay đổi hàng đầu

bottomShift int

Thay đổi bên dưới.

Examples

Ví dụ sau đây trồng một hình ảnh TIFF. Khu vực trồng được chỉ định thông qua bên trái, trên, bên phải, dưới cùng.

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)

Thực hiện phân phối trên hình ảnh hiện tại để cải thiện chất lượng thị giác của nó và giảmChất liệu liên kết màu sắc. tích hợp phương pháp này vào dòng công việc xử lý hình ảnh của bạnđảm bảo chuyển đổi giữa các màu sắc mịn hơn, dẫn đến cải thiện hình ảnh tổng thểxuất hiện và sự rõ ràng.

public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)

Parameters

ditheringMethod DitheringMethod

Phương pháp di chuyển.

bitsCount int

Các bit cuối cùng đếm cho dithering.

customPalette IColorPalette

Thói quen của palette cho dithering.

Examples

Ví dụ sau đây tải một hình ảnh TIFF và thực hiện ranh giới và chảy chảy bằng cách sử dụng độ sâu palette khác nhau.

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(Xác định, FilterOptionsBase)

Bộ lọc nội dung trong góc thẳng cụ thể, áp dụng một hình ảnh được chỉ địnhbộ lọc xử lý để cải thiện hoặc sửa đổi khu vực đã chọn.vào dòng công việc thao tác hình ảnh của bạn để đạt được các cải tiến được nhắm mục tiêu hoặcThay đổi trong ứng dụng của bạn.

public override void Filter(Rectangle rectangle, FilterOptionsBase options)

Parameters

rectangle Rectangle

Vòng thẳng.

options FilterOptionsBase

Các tùy chọn.

Examples

Ví dụ sau đây áp dụng các loại bộ lọc khác nhau cho một hình ảnh TIFF.

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 các tùy chọn có nguồn gốc từ cài đặt tệp ban đầu, tạo điều kiện cho không có dấu hiệubảo tồn các thông số chính như độ sâu bit và các thuộc tính thiết yếu khác củasử dụng phương pháp này để duy trì sự trung thành và tuân thủ trongNhiệm vụ xử lý hình ảnh, đảm bảo kết quả tối ưu mà không có thay đổi không cần thiết.Ví dụ, nếu chúng tôi tải một hình ảnh PNG màu đen và trắng với 1 bit mỗi pixel và sau đó lưu nó bằng cách sử dụngAspose.Imaging.DataStreamSupporter.Save(System.String) phương pháp, hình ảnh PNG output với 8 bit mỗi pixel sẽ được tạo ra.Để tránh nó và tiết kiệm hình ảnh PNG với 1 bit mỗi pixel, sử dụng phương pháp này để có được các tùy chọn tiết kiệm tương ứng và thông qua chúngđến phương pháp Aspose.Imaging.Image.Save(System.String,_W L17.ImageOptionsBase) như là thông số thứ hai.

public override ImageOptionsBase GetOriginalOptions()

Returns

ImageOptionsBase

Các tùy chọn dựa trên cài đặt tệp ban đầu.

Exceptions

TiffImageException

Không có tùy chọn ban đầu có thể được lấy từ hình ảnh

Grayscale()

Chuyển đổi hình ảnh thành đại diện rực rỡ của nó, biến nó thành mộthình ảnh kênh duy nhất nơi mỗi pixel đại diện cho cường độ.vào đường ống xử lý hình ảnh của bạn để đơn giản hóa phân tích và cải thiệntương thích với các thuật toán dựa trên grayscale, tạo điều kiện cho các máy tính khác nhauCác nhiệm vụ phân tích tầm nhìn và hình ảnh trong ứng dụng của bạn.

public override void Grayscale()

Examples

Ví dụ sau đây chuyển đổi một hình ảnh màu sắc TIFF thành đại diện màu xám của nó. Hình ảnh Grayscale được tạo thành độc quyền từ bóng râm và chỉ mang thông tin cường độ.

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(Nhãn hiệu: TiffFrame)

Nhập khung mới vào chỉ số được chỉ định trong chuỗi frame, đảm bảokiểm soát chính xác về sắp xếp khung.Hãy sử dụng phương pháp này để quản lý frametheo dõi hiệu quả, tạo điều kiện cho thao tác năng động và tổ chức hình ảnhnội dung trong ứng dụng của bạn.

public void InsertFrame(int index, TiffFrame frameToInsert)

Parameters

index int

Chỉ số frame mới trong danh sách frame

frameToInsert TiffFrame

khung để nhập.

NormalizeAngle(Bool, Màu sắc)

Sử dụng phương pháp NormalizeAngle được thiết kế đặc biệt cho các tài liệu văn bản được quétđể sửa chữa các quét, đảm bảo sự phù hợp chính xác.tích hợp chức năng này vào dòng công việc xử lý văn bản của bạn để cải thiệnĐọc và chất lượng tài liệu, cải thiện hiệu quả tổng thể trong việc công nhận văn bảnvà các nhiệm vụ phân tích.Phương pháp này sử dụng các phương pháp Aspose.Imaging.RasterImage.GetSkewAngle và Wl17.FileFormats.Tiff.ThiffImage.Rootate(System.Single,Sistem.Boolean,__W L17 _.Color).

public override void NormalizeAngle(bool resizeProportionally, Color backgroundColor)

Parameters

resizeProportionally bool

Nếu được thiết lập để ’truyền’ bạn sẽ có kích cỡ hình ảnh của bạn thay đổi theo hình chiếu trực tiếp xoay (các điểm góc) trong trường hợp khác để lại các kích cỡ không bị chạm và chỉ nội dung hình ảnh được xoay.

backgroundColor Color

Màu sắc của nền

ReleaseManagedResources()

Hãy chắc chắn rằng không có tài nguyên không được quản lý được phát hành ở đây, vì chúng có thể đã được phát hành.

protected override void ReleaseManagedResources()

RemoveFrame(int)

Thất bại loại bỏ khung được chỉ định bởi chỉ số của nó từ chuỗi hình ảnh,quản lý khuôn khổ trong ứng dụng của bạn. tích hợp điều nàychức năng để tăng hiệu quả và độ chính xác trong thao tác khung,tạo điều kiện cho việc tổ chức và trình bày nội dung hình ảnh.

public TiffFrame RemoveFrame(int index)

Parameters

index int

Chỉ số frame được loại bỏ.

Returns

TiffFrame

khung bị loại bỏ.

Examples

Ví dụ sau đây cho thấy làm thế nào để tạo thành một TIFF mutlipage từ các hình ảnh raster cá nhân.

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 &lt;= 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

Lưu ý: đừng quên cài đặt khung nếu bạn không thêm vào một số TiffImage khác.

RemoveFrame(TiffFrame)

Hiệu quả loại bỏ khung cụ thể từ chuỗi hình ảnh, tạo điều kiệnquản lý khung nhanh chóng trong ứng dụng của bạn. tích hợp chức năng nàyđể tăng độ chính xác và linh hoạt trong việc thao tác khung, đảm bảo an toànTổ chức và trình bày nội dung hình ảnh.

public void RemoveFrame(TiffFrame frame)

Parameters

frame TiffFrame

khung để loại bỏ.

Remarks

Lưu ý: đừng quên cài đặt khung nếu bạn không thêm vào một số TiffImage khác.

RemoveMetadata()

Xóa các metadata mẫu hình này bằng cách thiết lập các giá trị này Aspose.Imaging.Xmp.IHasXmphData.xmpdata và Wl17.Exif.IHasexifDate. 0 0 0.

public override void RemoveMetadata()

ReplaceFrame(Nhãn hiệu: TiffFrame)

Thay thế khung ở vị trí được chỉ định bằng khớp khác một cách không ngừng,tạo điều kiện quản lý khung năng động trong chuỗi hình ảnh. tích hợp điều nàyphương pháp để tăng tính linh hoạt và độ chính xác trong thao tác khung, đảm bảotổ chức tối ưu và trình bày nội dung hình ảnh trong ứng dụng của bạn.

public TiffFrame ReplaceFrame(int index, TiffFrame frameToReplace)

Parameters

index int

Vị trí khung dựa trên zero.

frameToReplace TiffFrame

khung để thay thế.

Returns

TiffFrame

khung bị loại bỏ.

Remarks

Lưu ý: đừng quên cài đặt khung nếu bạn không thêm vào một số TiffImage khác.

Resize(int, int, resizeType)

Xác định hình ảnh theo loại khôi phục cụ thể, tạo điều kiện linh hoạtđiều chỉnh kích thước hình ảnh trong khi duy trì tỷ lệ khía cạnh hoặc áp dụng cụ thểTích hợp phương pháp này vào dòng công việc xử lý hình ảnh của bạnđể đạt được kiểm soát chính xác về các hoạt động tái thực hiện trong ứng dụng của bạn.

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

Chiều rộng mới

newHeight int

Độ cao mới

resizeType ResizeType

Loại Resize

Examples

Ví dụ này tải một hình ảnh TIFF và resize nó bằng cách sử dụng các phương pháp resizing khác nhau.

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)

Điều chỉnh kích thước của hình ảnh dựa trên cài đặt cụ thể, cho phép chính xáckiểm soát các kích thước, tỷ lệ khía cạnh, và hành vi quy mô.phương pháp vào dòng công việc xử lý hình ảnh của bạn để đạt được khôi phục tùy chỉnhhoạt động phù hợp với các yêu cầu cụ thể của ứng dụng của bạn.

public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)

Parameters

newWidth int

Chiều rộng mới

newHeight int

Độ cao mới

settings ImageResizeSettings

Các thiết lập resize.

Examples

Ví dụ này tải một hình ảnh TIFF và resize nó bằng cách sử dụng các cài đặt resizing khác nhau.

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(Nhãn hiệu: ResizeType)

Thực hiện điều chỉnh tương đối về chiều cao của hình ảnh, duy trì khía cạnh của nótỷ lệ cho tính toàn vẹn thị giác liên tục. sử dụng phương pháp này để phục hồi năng độnghình ảnh trong ứng dụng của bạn, đảm bảo hiển thị tối ưu trên các nền tảng khác nhauvà các thiết bị mà không làm hỏng chất lượng nội dung.

public override void ResizeHeightProportionally(int newHeight, ResizeType resizeType)

Parameters

newHeight int

Độ cao mới

resizeType ResizeType

Loại của resize.

Examples

Ví dụ này tải một hình ảnh TIFF và resize nó tương đối bằng cách sử dụng các phương pháp resizing khác nhau. chỉ chiều cao được chỉ định, chiều rộng được tính toán tự động.

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)

Thực hiện một hoạt động khôi phục tương đối trên hình ảnh, duy trì khía cạnh của nó bằng cách điều chỉnh kích thước. Sử dụng phương pháp này để quy mô hình động trong ứng dụng của bạn, đảm bảo sự đại diện trực quan nhất quán của tính toàn vẹn nội dung.Kết quả phân giải tương đương sẽ làm lại mỗi khung theo tỷ lệ của newWidth’/width và <các code class=paran>newHeight’ / height.

public void ResizeProportional(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

Chiều rộng mới

newHeight int

Độ cao mới

resizeType ResizeType

Loại Resize

ResizeWidthProportionally(Nhãn hiệu: ResizeType)

Điều chỉnh chiều rộng của hình ảnh trong khi duy trì tỷ lệ khía cạnh của nó, đảm bảoPhân phối tương đối để hiển thị hình ảnh tối ưu. Sử dụng phương pháp này đểdynamically scale hình ảnh trong ứng dụng của bạn, tạo điều kiện liên tục vàthẩm mỹ vui vẻ rendering qua các bối cảnh hiển thị khác nhau.

public override void ResizeWidthProportionally(int newWidth, ResizeType resizeType)

Parameters

newWidth int

Chiều rộng mới

resizeType ResizeType

Loại của resize.

Examples

Ví dụ này tải một hình ảnh TIFF và resize nó tương đối bằng cách sử dụng các phương pháp resizing khác nhau. chỉ có chiều rộng được chỉ định, chiều cao được tính toán tự động.

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, Màu sắc)

xoay hình ảnh xung quanh điểm trung tâm của nó bằng một góc cụ thể, cho phép chính xácđiều chỉnh định hướng. Thêm chức năng này vào xử lý hình ảnh của bạnđường ống để tạo điều kiện chuyển đổi chính xác, đảm bảo sự phù hợp tối ưu vàtrình bày nội dung trực quan trong ứng dụng của bạn.

public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)

Parameters

angle float

góc xoay trong độ. giá trị tích cực sẽ xoay theo cách đồng hồ.

resizeProportionally bool

Nếu được thiết lập để ’truyền’ bạn sẽ có kích cỡ hình ảnh của bạn thay đổi theo hình chiếu trực tiếp xoay (các điểm góc) trong trường hợp khác để lại các kích cỡ không bị chạm và chỉ nội dung hình ảnh được xoay.

backgroundColor Color

Màu sắc của nền

Examples

Ví dụ sau đây cho thấy làm thế nào để xoay hình ảnh TIFF xung quanh trung tâm bằng 45 độ đồng hồ.

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)

Thực hiện xoay, trượt, hoặc sự kết hợp của cả hai hoạt động độc quyền trênphương pháp này cho phép thao tác chính xác của các khung cá nhân trongtheo dõi hình ảnh, tăng tính linh hoạt trong việc chỉnh sửa và biên soạn nội bộứng dụng của bạn.

public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

Loại Flip Rotate

Examples

Ví dụ này tải một hình ảnh TIFF, xoay nó bằng 90 độ theo chiều đồng hồ và tùy chọn nhấp vào hình dạng ngang và/hoặc dọc.

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)

Lưu dữ liệu của đối tượng vào dòng cụ thể.

protected override void SaveData(Stream stream)

Parameters

stream Stream

dòng để lưu dữ liệu của đối tượng đến.

SetResolution(đôi, double)

Thiết lập độ phân giải cho Aspose.Imaging.RasterImage, cho phépkiểm soát chính xác các thuộc tính rendering hình ảnh và hiển thị. tích hợp điều nàychức năng để tối ưu hóa kết quả thị giác và đảm bảo tương thích với đa dạngthiết bị sản xuất và nền tảng, cải thiện trải nghiệm người dùng tổng thể.

public override void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

Độ phân giải ngang, ở điểm mỗi inch, của Aspose.Imaging.RasterImage.

dpiY double

Độ phân giải dọc, ở điểm mỗi inch, của Aspose.Imaging.RasterImage.

Examples

Ví dụ sau đây cho thấy làm thế nào để thiết lập độ phân giải horizontal/vertical của một hình ảnh TIFF.

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(int, int)

Cập nhật kích thước hình ảnh.

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

Hình ảnh mới rộng.

newHeight int

Độ cao hình ảnh mới.

Exceptions

NotImplementedException

 Tiếng Việt