Class TiffFrame

Class TiffFrame

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

Cấu hình tiff frame

[JsonObject(MemberSerialization.OptIn)]
public sealed class TiffFrame : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasExifData, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage TiffFrame

Implements

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

Thành viên thừa kế

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.IsCached , 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.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 , 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.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.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

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

Constructors

TiffFrame(Stream)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(Stream stream)

Parameters

stream Stream

Các dòng để tải một hình ảnh từ và khởi động các pixel frame và dữ liệu palette với.

TiffFrame(Stream, TiffOptions)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(Stream stream, TiffOptions options)

Parameters

stream Stream

Các dòng để tải một hình ảnh từ và khởi động các pixel frame và dữ liệu palette với.

options TiffOptions

Các tùy chọn để sử dụng cho khung mới được tạo.

TiffFrame(String)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(string path)

Parameters

path string

Con đường để tải một hình ảnh từ và bắt đầu frame pixel và palette dữ liệu với.

TiffFrame(Thẻ, TiffOptions)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(string path, TiffOptions options)

Parameters

path string

Con đường để tải một hình ảnh từ và bắt đầu frame pixel và palette dữ liệu với.

options TiffOptions

Các tùy chọn để sử dụng cho khung mới được tạo.

TiffFrame(RasterImage)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(RasterImage image)

Parameters

image RasterImage

Hình ảnh để bắt đầu frame pixel và palette dữ liệu với.

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 <= 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();
                                                                                                     }

TiffFrame(RasterImage, TiffOptions)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(RasterImage image, TiffOptions options)

Parameters

image RasterImage

Hình ảnh để bắt đầu frame pixel và palette dữ liệu với.

options TiffOptions

Các tùy chọn để sử dụng cho khung mới được tạo.

TiffFrame(TiffOptions , int, int)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.FileFormats.Tiff. TiffFrame.

public TiffFrame(TiffOptions options, int width, int height)

Parameters

options TiffOptions

Các tùy chọn frame.

width int

Chiều rộng .

height int

Độ cao .

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

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

Parameter tùy chọn là null.

Properties

BackgroundColor

Nhận hoặc đặt giá trị cho màu nền.

public override Color BackgroundColor { get; set; }

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

Color

BitsPerPixel

Nhận bit hình ảnh theo số pixel.

public override int BitsPerPixel { get; }

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

int

ExifData

Nhận hoặc đặt dữ liệu EXIF từ khung.

public ExifData ExifData { get; set; }

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

ExifData

FrameOptions

Gets frame tạo ra các tùy chọn.

public TiffOptions FrameOptions { get; }

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

TiffOptions

HasAlpha

Nó nhận được một giá trị chỉ ra liệu trường hợp này có alpha hay không.

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

HasTransparentColor

Nó nhận được một giá trị cho thấy liệu hình ảnh có màu sắc minh bạch hay không.

public override bool HasTransparentColor { get; set; }

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

bool

Height

Nhận được độ cao hình ảnh.

public override int Height { get; }

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

int

HorizontalResolution

Nhận hoặc đặt độ phân giải ngang, trong pixels per inch, của Aspose.Imaging.RasterImage.

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 ngang / dọc của một khung TIFF riêng biệt.

string dir = "c:\\temp\\";

                                                                                                          // Load a TIFF image from a file.
                                                                                                          using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                          {
                                                                                                              Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                              int i = 0;
                                                                                                              foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
                                                                                                              {
                                                                                                                  // Get horizontal and vertical resolution of the TiffFrame.
                                                                                                                  double horizontalResolution = frame.HorizontalResolution;
                                                                                                                  double verticalResolution = frame.VerticalResolution;
                                                                                                                  System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
                                                                                                                  System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, 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");
                                                                                                                      frame.SetResolution(96.0, 96.0);

                                                                                                                      System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
                                                                                                                      System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, verticalResolution);
                                                                                                                  }

                                                                                                                  ++i;
                                                                                                              }
                                                                                                          }

PathResources

Nhận hoặc đặt con đường tài nguyên.

public List<pathresource> PathResources { get; set; }

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

List < PathResource >

Examples

Transfer Clipping Paths trong quá trình xuất từ TIFF đến hình ảnh PSD.

using (var image = Image.Load("Sample.tif"))
                                                                        {
                                                                            image.Save("SampleWithPaths.psd", new PsdOptions());
                                                                        }

Ví dụ sau đây cho thấy làm thế nào để thu thập các con đường từ hình ảnh TIFF và hiển thị tên của họ trong console.

using (var image = (TiffImage)Image.Load("Sample.tif"))
                                                                                                                    {
                                                                                                                        foreach (var path in image.ActiveFrame.PathResources)
                                                                                                                        {
                                                                                                                            Console.WriteLine(path.Name);
                                                                                                                        }
                                                                                                                    }

Ví dụ sau đây cho thấy làm thế nào để sửa đổi các con đường nhấp chuột hiện có. ví dụ, bạn chỉ có thể giữ một con Đường nhảy trong hình ảnh.

using (var image = (TiffImage)Image.Load("Sample.tif"))
                                                                                                                                                     {
                                                                                                                                                         var paths = image.ActiveFrame.PathResources;
                                                                                                                                                         image.ActiveFrame.PathResources = paths.Take(1).ToList();
                                                                                                                                                         image.Save();
                                                                                                                                                     }

Ví dụ sau đây cho thấy làm thế nào để tạo Clipping Path trong hình ảnh TIFF. Để làm điều đó, bạn cần tạo một trường hợp của lớp PithResource. Mã sau này cho biết cách bạn có thể tạo ra một con đường trống trong ảnh tIFf.

var options = new TiffOptions(TiffExpectedFormat.Default);
                                                                                                                                                                                                                                                   var frame = new TiffFrame(options, 800, 600);

                                                                                                                                                                                                                                                   using (var image = new TiffImage(frame))
                                                                                                                                                                                                                                                   {
                                                                                                                                                                                                                                                       image.ActiveFrame.PathResources = new List<pathresource>
                                                                                                                                                                                                                                                       {
                                                                                                                                                                                                                                                           new PathResource
                                                                                                                                                                                                                                                           {
                                                                                                                                                                                                                                                               BlockId = 2000,
                                                                                                                                                                                                                                                               Name = "My Clipping Path",
                                                                                                                                                                                                                                                               Records = new List<vectorpathrecord>()
                                                                                                                                                                                                                                                           }
                                                                                                                                                                                                                                                       };

                                                                                                                                                                                                                                                       image.Save("ImageWithEmptyPath.tiff");
                                                                                                                                                                                                                                                   }</vectorpathrecord></pathresource>

Tạo Clipping Path bằng tay.

static void Main()
                                         {
                                             using (var image = (TiffImage)Image.Load("Sample.tif"))
                                             {
                                                 image.ActiveFrame.PathResources = new List<pathresource> { new PathResource
                                                 {
                                                     BlockId = 2000,                                                          // Block Id according to Photoshop specification
                                                     Name = "My Clipping Path",                                               // Path name
                                                     Records = CreateRecords(0.2f, 0.2f, 0.8f, 0.2f, 0.8f, 0.8f, 0.2f, 0.8f)  // Create path records using coordinates
                                                 }};

                                                 image.Save("ImageWithPath.tif");
                                             }
                                         }

                                         private static List<vectorpathrecord> CreateRecords(params float[] coordinates)
                                         {
                                             var records = CreateBezierRecords(coordinates);                                  // Create Bezier records using coordinates

                                             records.Insert(0, new LengthRecord                                               // LengthRecord required by Photoshop specification
                                             {
                                                 IsOpen = false,                                                              // Lets create closed path
                                                 RecordCount = (ushort)records.Count                                          // Record count in the path
                                             });

                                             return records;
                                         }

                                         private static List<vectorpathrecord> CreateBezierRecords(float[] coordinates)
                                         {
                                             return CoordinatesToPoints(coordinates)
                                                 .Select(CreateBezierRecord)
                                                 .ToList();
                                         }

                                         private static IEnumerable<pointf> CoordinatesToPoints(float[] coordinates)
                                         {
                                             for (var index = 0; index &lt; coordinates.Length; index += 2)
                                                 yield return new PointF(coordinates[index], coordinates[index + 1]);
                                         }

                                         private static VectorPathRecord CreateBezierRecord(PointF point)
                                         {
                                             return new BezierKnotRecord { PathPoints = new[] { point, point, point } };
                                         }</pointf></vectorpathrecord></vectorpathrecord></pathresource>

VerticalResolution

Nhận hoặc đặt độ phân giải dọc, trong pixel mỗi inch, của Aspose.Imaging.RasterImage.

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 ngang / dọc của một khung TIFF riêng biệt.

string dir = "c:\\temp\\";

                                                                                                          // Load a TIFF image from a file.
                                                                                                          using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
                                                                                                          {
                                                                                                              Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

                                                                                                              int i = 0;
                                                                                                              foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
                                                                                                              {
                                                                                                                  // Get horizontal and vertical resolution of the TiffFrame.
                                                                                                                  double horizontalResolution = frame.HorizontalResolution;
                                                                                                                  double verticalResolution = frame.VerticalResolution;
                                                                                                                  System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
                                                                                                                  System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, 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");
                                                                                                                      frame.SetResolution(96.0, 96.0);

                                                                                                                      System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
                                                                                                                      System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, verticalResolution);
                                                                                                                  }

                                                                                                                  ++i;
                                                                                                              }
                                                                                                          }

Width

Nhận được chiều rộng hình ảnh

public override int Width { get; }

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

int

XmpData

Nhận hoặc đặt dữ liệu Xmp.

public override XmpPacketWrapper XmpData { get; set; }

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

XmpPacketWrapper

Methods

AlignResolutions()

Phương pháp hỗ trợ để làm cho độ phân giải ngang và dọc bình đẳng.

public void AlignResolutions()

CopyFrame(TiffFrame)

Sao chép toàn bộ khung (duplicates).

public static TiffFrame CopyFrame(TiffFrame tiffFrame)

Parameters

tiffFrame TiffFrame

Tiff frame để sao chép.

Returns

TiffFrame

Cấu hình tiff mới được sao chép

CreateFrameFrom(TiffFrame và TifOptions)

Tạo khung từ cụ thể tiffFrame’ bằng cách sử dụng các tùy chọn <các mã class=paran>".Dữ liệu pixel được bảo quản nhưng được chuyển đổi sang định dạng mong muốn.

public static TiffFrame CreateFrameFrom(TiffFrame tiffFrame, TiffOptions options)

Parameters

tiffFrame TiffFrame

Cấu hình tiff để tạo ra từ.

options TiffOptions

Các lựa chọn mới để sử dụng.

Returns

TiffFrame

khung mới được tạo ra.

Examples

Ví dụ sau đây cho thấy làm thế nào để tạo một bản sao grayscale của một khung hiện có và thêm nó vào hình ảnh TIFF.

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 + "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))
                                                                                                                      {
                                                                                                                          // 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 a linear gradient brush.
                                                                                                                          Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
                                                                                                                          gr.FillRectangle(brush, tiffImage.Bounds);

                                                                                                                          // Grayscale options
                                                                                                                          Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
                                                                                                                          createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
                                                                                                                          createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
                                                                                                                          createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };

                                                                                                                          // Create a grayscale copy of the active frame.
                                                                                                                          // The pixel data is preserved but converted to the desired format.
                                                                                                                          Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);

                                                                                                                          // Add the newly created frame to the TIFF image.
                                                                                                                          tiffImage.AddFrame(grayscaleFrame);

                                                                                                                          tiffImage.Save();
                                                                                                                      }

Crop(Rectangle)

Khai thác hình ảnh

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

Vòng thẳng.

GetOriginalOptions()

Nhận các tùy chọn dựa trên cài đặt tệp ban đầu.Điều này có thể hữu ích để giữ độ sâu bit và các thông số khác của hình ảnh ban đầu không thay đổi.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.

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

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

Resize(int, int, resizeType)

Xóa lại hình ảnh.

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

Rotate(Float, Bool, Màu sắc)

Hình ảnh xoay quanh trung tâm.

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

SaveData(Stream)

Tiết kiệm dữ liệu

protected override void SaveData(Stream stream)

Parameters

stream Stream

Stream để lưu dữ liệu đến.

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.

 Tiếng Việt