Class TiffOptions

Class TiffOptions

Nom dels espais: Aspose.Imaging.ImageOptions Assemblea: Aspose.Imaging.dll (25.4.0)

Opcions de format de fitxers tiff.Tingueu en compte que les etiquetes d’amplada i altitud s’inscriurà sobre la creació de la imatge per paràmetres de amplea i alçada, de manera que no cal especificar-les directament.Tingueu en compte que moltes opcions tornen un valor predefinit però això no significa que aquesta opció es defineixi explícitament com a valor de la etiqueta.

[JsonObject(MemberSerialization.OptIn)]
public class TiffOptions : ImageOptionsBase, IDisposable, ICloneable, IHasExifData, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject ImageOptionsBase TiffOptions

Derived

BigTiffOptions

Implements

IDisposable , ICloneable , IHasExifData , IHasXmpData , IHasMetadata

Membres heretats

ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , 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

Aquest exemple demostra l’ús de diferents classes de SaveOptions Namespace per a finalitats d’exportació. Una imatge del tipus Gif es carrega en una instància de Imatge i després es exporta a diversos formats.

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

                                                                                                                                                                                                                    //Load an existing image (of type Gif) in an instance of Image class
                                                                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                        //Export to BMP file format using the default options
                                                                                                                                                                                                                        image.Save(dir + "output.bmp", new Aspose.Imaging.ImageOptions.BmpOptions());

                                                                                                                                                                                                                        //Export to JPEG file format using the default options
                                                                                                                                                                                                                        image.Save(dir + "output.jpg", new Aspose.Imaging.ImageOptions.JpegOptions());

                                                                                                                                                                                                                        //Export to PNG file format using the default options
                                                                                                                                                                                                                        image.Save(dir + "output.png", new Aspose.Imaging.ImageOptions.PngOptions());

                                                                                                                                                                                                                        //Export to TIFF file format using the default options
                                                                                                                                                                                                                        image.Save(dir + "output.tif", new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default));
                                                                                                                                                                                                                    }

L’exemple següent mostra com convertir una imatge de vector de múltiples pàgines en format TIFF en general sense referència a un tipus d’imatge particular.

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
                                                                                                                                                            string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
                                                                                                                                                            string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.tiff");

                                                                                                                                                            Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
                                                                                                                                                            {
                                                                                                                                                                exportOptions.MultiPageOptions = null;

                                                                                                                                                                // Export only first two pages. These pages will be presented as frames in the output TIFF.
                                                                                                                                                                Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
                                                                                                                                                                if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
                                                                                                                                                                {
                                                                                                                                                                    exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
                                                                                                                                                                }

                                                                                                                                                                if (image is Aspose.Imaging.VectorImage)
                                                                                                                                                                {
                                                                                                                                                                    exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
                                                                                                                                                                    exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
                                                                                                                                                                    exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
                                                                                                                                                                }

                                                                                                                                                                image.Save(outputFilePath, exportOptions);
                                                                                                                                                            }

Aquests exemples fan ús de la classe GraphicsPath i Gràfics per crear i manipular Figures en una superfície d’imatge. Exemple crea una nova imatge (de tipus Tiff), neteja la superficial i treu els camins amb l’ajuda de Class Grapics.

//Create an instance of FileStream
                                                                                                                                                                                                                                                                                                                                             using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                                                                                                 //Create an instance of TiffOptions and set its various properties
                                                                                                                                                                                                                                                                                                                                                 Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                                                                                                                                                                                                                                                                 //Set the source for the instance of ImageOptions
                                                                                                                                                                                                                                                                                                                                                 tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                                                                                                 //Create an instance of Image 
                                                                                                                                                                                                                                                                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
                                                                                                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                                                                                                     //Create and initialize an instance of Graphics class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                                                                                                     //Clear Graphics surface
                                                                                                                                                                                                                                                                                                                                                     graphics.Clear(Color.Wheat);

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of GraphicsPath class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();

                                                                                                                                                                                                                                                                                                                                                     //Create an instance of Figure class
                                                                                                                                                                                                                                                                                                                                                     Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();

                                                                                                                                                                                                                                                                                                                                                     //Add Shapes to Figure object
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
                                                                                                                                                                                                                                                                                                                                                     figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));

                                                                                                                                                                                                                                                                                                                                                     //Add Figure object to GraphicsPath
                                                                                                                                                                                                                                                                                                                                                     graphicspath.AddFigure(figure);

                                                                                                                                                                                                                                                                                                                                                     //Draw path with Pen object of color Black
                                                                                                                                                                                                                                                                                                                                                     graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);

                                                                                                                                                                                                                                                                                                                                                     // save all changes.
                                                                                                                                                                                                                                                                                                                                                     image.Save();
                                                                                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                                                                                             }

Constructors

TiffOptions(Formació, TiffByteOrder)

Inicialitza una nova instància de la classe Aspose.Imaging.ImageOptions.TiffOpcions.

public TiffOptions(TiffExpectedFormat expectedFormat, TiffByteOrder byteOrder)

Parameters

expectedFormat TiffExpectedFormat

El format de fitxer tiff esperat.

byteOrder TiffByteOrder

El format de fitxer tiff ordre de byte per utilitzar.

TiffOptions(TiffExpectedFormat)

Inicialitza una nova instància de la classe Aspose.Imaging.ImageOptions.TiffOpcions.

public TiffOptions(TiffExpectedFormat expectedFormat)

Parameters

expectedFormat TiffExpectedFormat

El format de fitxer tiff esperat.

Examples

L’exemple següent mostra com crear una còpia de graus d’un marc existent i afegir-lo a una imatge 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();
                                                                                                                      }

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

TiffOptions(TiffOptions)

Inicialitza una nova instància de la classe Aspose.Imaging.ImageOptions.TiffOpcions.

public TiffOptions(TiffOptions options)

Parameters

options TiffOptions

Les opcions per copiar.

TiffOptions(TiffDataType[])

Inicialitza una nova instància de la classe Aspose.Imaging.ImageOptions.TiffOpcions.

public TiffOptions(TiffDataType[] tags)

Parameters

tags TiffDataType []

Les etiquetes per iniciar les opcions amb.

Properties

AlphaStorage

Obté o estableix l’opció d’emmagatzematge alfa. Opcions diferents de Aspose.Imaging.FileFormats.Tiff.Enums. TiffAlphaStorage.Unspecificatss’utilitzen quan hi ha més de 3 Aspose.Imaging.ImageOptions.TiffOpcions.SamplesPerPixel definit.

public TiffAlphaStorage AlphaStorage { get; set; }

Valor de la propietat

TiffAlphaStorage

Artist

Obté o col·loca l’artista.

public string Artist { get; set; }

Valor de la propietat

string

BitsPerPixel

Realitza els bit per pixel.

public int BitsPerPixel { get; }

Valor de la propietat

int

BitsPerSample

Obté o col·loca els bites per mostra.

public ushort[] BitsPerSample { get; set; }

Valor de la propietat

ushort []

Examples

Aquest exemple mostra com crear una imatge TIFF des de l’escratx i salvar-la a un fitxer.

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

L’exemple següent mostra com compondre un mutlipage TIFF de les imatges de rastres individuals.

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

L’exemple següent mostra com crear una còpia de graus d’un marc existent i afegir-lo a una imatge 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();
                                                                                                                      }

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Aquest exemple mostra com crear una imatge TIFF amb 2 quadres i salvar-la a un fitxer.

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

Remarks

Quan s’estableix aquest valor, tingueu en compte que també configurarà el valor de SamplesPerPixel per arreglar la longitud. Aquestes 2 propietats estan molt estretament conjugades, de manera que només es pot definir tot.

ByteOrder

Obté o estableix un valor que indiqui l’ordre de tiff byte.

public TiffByteOrder ByteOrder { get; set; }

Valor de la propietat

TiffByteOrder

Examples

Aquest exemple mostra com crear una imatge TIFF des de l’escratx i salvar-la a un fitxer.

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

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Aquest exemple mostra com crear una imatge TIFF amb 2 quadres i salvar-la a un fitxer.

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

ColorMap

Obté o col·loca el mapa de colors.

public ushort[] ColorMap { get; set; }

Valor de la propietat

ushort []

Exceptions

ArgumentNullException

Valor

TiffImageException

El mapa de colors es pot definir per a les mostres per pixel igual a 1 només.oEls bits per mostra no es defineixen.

ArgumentOutOfRangeException

La longitud de l’arrel ha de correspondre a la fórmula de seguiment: 3 * (2**BitsPerSample).

CompressedQuality

Obté o estableix la qualitat d’imatge compresa.Utilitzat amb la compressió Jpeg.

public int CompressedQuality { get; set; }

Valor de la propietat

int

Examples

Aquest exemple mostra com crear una imatge TIFF amb la compressió Jpeg i la qualitat d’imatge compresa especificada.

using (Aspose.Imaging.FileFormats.Tiff.TiffImage image = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Aspose.Imaging.Image.Load("c:\\temp\\zeebra.tif"))
                                                                                                                              {
                                                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
                                                                                                                                  // Set the RGB color model.
                                                                                                                                  tiffOptions.Photometric = TiffPhotometrics.Rgb;
                                                                                                                                  // Set the Jpeg compression.
                                                                                                                                  tiffOptions.Compression = TiffCompressions.Jpeg;
                                                                                                                                  tiffOptions.CompressedQuality = 50;
                                                                                                                                  // Set 8 bits for each color component.
                                                                                                                                  tiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                                                  image.Save("zeebra.tif-50.tiff", tiffOptions);
                                                                                                                              }

Compression

Obtenir o posar la compressió.

public TiffCompressions Compression { get; set; }

Valor de la propietat

TiffCompressions

Examples

Aquest exemple mostra com crear una imatge TIFF des de l’escratx i salvar-la a un fitxer.

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

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Aquest exemple mostra com crear una imatge TIFF amb 2 quadres i salvar-la a un fitxer.

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

Copyright

Obtenir o establir els drets d’autor.

public string Copyright { get; set; }

Valor de la propietat

string

DateTime

Obté o fixa la data i l’hora.

public string DateTime { get; set; }

Valor de la propietat

string

DefaultMemoryAllocationLimit

Obté o estableix el límit d’allotjament de memòria estàndard.

[Obsolete("Use Aspose.Imaging.Image.BufferSizeHint, Aspose.Imaging.ImageOptionsBase.BufferSizeHint or Aspose.Imaging.LoadOptions.BufferSizeHint instead.")]
public int DefaultMemoryAllocationLimit { get; set; }

Valor de la propietat

int

DisableIccExport

Obté o estableix un valor que indiqui si l’exportació del perfil de la ICC està desactivada (el perfil d’ICC s’aplica als píxels de font prèviament).

[JsonProperty]
public bool DisableIccExport { get; set; }

Valor de la propietat

bool

DocumentName

Obtenir o posar el nom del document.

public string DocumentName { get; set; }

Valor de la propietat

string

ExifData

Obtenir o col·locar dades Exif.

public ExifData ExifData { get; set; }

Valor de la propietat

ExifData

ExifIfd

Obté o posa l’indicador a EXIF IFD.

public TiffExifIfd ExifIfd { get; }

Valor de la propietat

TiffExifIfd

ExtraSamples

Obtenir els valors de mostres extra.

public ushort[] ExtraSamples { get; }

Valor de la propietat

ushort []

FaxT4Options

Obtenir o establir les opcions de fax t4.

public Group3Options FaxT4Options { get; set; }

Valor de la propietat

Group3Options

FileStandard

Obtenir o establir l’estàndard de fitxer TIFF.

public TiffFileStandards FileStandard { get; set; }

Valor de la propietat

TiffFileStandards

FillOrder

Obtenir o posar les bites de byte omplir l’ordre.

public TiffFillOrders FillOrder { get; set; }

Valor de la propietat

TiffFillOrders

HalfToneHints

Obté o col·loca les puntuacions de la meitat.

public ushort[] HalfToneHints { get; set; }

Valor de la propietat

ushort []

Exceptions

ArgumentNullException

Valor

ArgumentOutOfRangeException

Valor;La longitud de l’arrel d’indicadors de Halftone ha de ser igual a 2.

IccProfile

Obtenir o configurar el flux del perfil Icc.

public MemoryStream IccProfile { get; set; }

Valor de la propietat

MemoryStream

ImageDescription

Obté o col·loca la descripció de la imatge.

public string ImageDescription { get; set; }

Valor de la propietat

string

ImageLength

Obté o fixa la longitud de la imatge.

public uint ImageLength { get; set; }

Valor de la propietat

uint

ImageWidth

Obtenir o establir l’amplada de la imatge.

public uint ImageWidth { get; set; }

Valor de la propietat

uint

InkNames

Obtenir o posar els noms de la tinta.

public string InkNames { get; set; }

Valor de la propietat

string

IsExtraSamplesPresent

Obté un valor que indica si les mostres addicionals són presents.

public bool IsExtraSamplesPresent { get; }

Valor de la propietat

bool

IsTiled

Obté un valor que indiqui si la imatge està inclosa.

public bool IsTiled { get; }

Valor de la propietat

bool

IsValid

Obté un valor que indica si la Aspose.Imaging.ImageOptions.TiffOpcions s’han configurat correctament. Utilitzeu el mètode de validació per trobar la raó de fracàs.

public bool IsValid { get; }

Valor de la propietat

bool

MaxSampleValue

Obtenir o establir el valor de la mostra màxima.

public ushort[] MaxSampleValue { get; set; }

Valor de la propietat

ushort []

Exceptions

ArgumentNullException

Valor

ArgumentOutOfRangeException

La longitud de l’arrel ha de correspondre a les mostres per càlcul de píxels.

MinSampleValue

Obté o fixa el valor de la mostra mínima.

public ushort[] MinSampleValue { get; set; }

Valor de la propietat

ushort []

Exceptions

ArgumentNullException

Valor

ArgumentOutOfRangeException

La longitud de l’arrel ha de correspondre a les mostres per càlcul de píxels.

Orientation

Obtenir o establir l’orientació.

public TiffOrientations Orientation { get; set; }

Valor de la propietat

TiffOrientations

PageName

Obtenir o posar el nom de la pàgina.

public string PageName { get; set; }

Valor de la propietat

string

PageNumber

Obtenir o marcar el número de pàgina.

public ushort[] PageNumber { get; set; }

Valor de la propietat

ushort []

Exceptions

ArgumentNullException

Valor

ArgumentOutOfRangeException

Valor;Esperit 2 valors en l’arrel: PageNumber[0] és el nombre de pàgina i Page Numble[1] és la quantitat total de pàgines en el document.

Palette

Obté o posa la paleta de colors.

public override IColorPalette Palette { get; set; }

Valor de la propietat

IColorPalette

Photometric

Obté o col·loca la fotometria.

public TiffPhotometrics Photometric { get; set; }

Valor de la propietat

TiffPhotometrics

Examples

Aquest exemple mostra com crear una imatge TIFF des de l’escratx i salvar-la a un fitxer.

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

L’exemple següent mostra com compondre un mutlipage TIFF de les imatges de rastres individuals.

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

L’exemple següent mostra com crear una còpia de graus d’un marc existent i afegir-lo a una imatge 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();
                                                                                                                      }

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Aquest exemple mostra com crear una imatge TIFF amb 2 quadres i salvar-la a un fitxer.

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

PlanarConfiguration

Obtenir o configurar la configuració de plànol.

public TiffPlanarConfigs PlanarConfiguration { get; set; }

Valor de la propietat

TiffPlanarConfigs

Examples

Aquest exemple mostra com crear una imatge TIFF des de l’escratx i salvar-la a un fitxer.

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

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Aquest exemple mostra com crear una imatge TIFF amb 2 quadres i salvar-la a un fitxer.

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

Predictor

Obté o posa el predictor per a la compressió LZW.

public TiffPredictor Predictor { get; set; }

Valor de la propietat

TiffPredictor

Examples

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

PremultiplyComponents

Obté o estableix un valor que indiqui si els components han de ser premultipliats.

[JsonProperty]
public bool PremultiplyComponents { get; set; }

Valor de la propietat

bool

ResolutionSettings

Obtén o estableix les configuracions de resolució.

public override ResolutionSetting ResolutionSettings { get; set; }

Valor de la propietat

ResolutionSetting

ResolutionUnit

Obtenir o establir la unitat de resolució.

public TiffResolutionUnits ResolutionUnit { get; set; }

Valor de la propietat

TiffResolutionUnits

RowsPerStrip

Obtenir o col·locar les files per barra.

public uint RowsPerStrip { get; set; }

Valor de la propietat

uint

SampleFormat

Obté o col·loca el format de mostra.

public TiffSampleFormats[] SampleFormat { get; set; }

Valor de la propietat

TiffSampleFormats []

Exceptions

ArgumentNullException

Valor

ArgumentOutOfRangeException

La longitud de l’arrel ha de correspondre a les mostres per càlcul de píxels.

SamplesPerPixel

Per canviar aquest valor de la propietat, utilitzeu el Aspose.Imaging.ImageOptions.TiffOpcions.BitsPerSample.

public ushort SamplesPerPixel { get; }

Valor de la propietat

ushort

ScannerManufacturer

Obté o col·loca el fabricant de l’escàner.

public string ScannerManufacturer { get; set; }

Valor de la propietat

string

ScannerModel

Obté o col·loca el model de l’escàner.

public string ScannerModel { get; set; }

Valor de la propietat

string

SmaxSampleValue

El valor té un tipus de camp que millor coincideix amb les dades de mostra (tipus bit, curt o llarg).

public uint[] SmaxSampleValue { get; set; }

Valor de la propietat

uint []

SminSampleValue

El valor té un tipus de camp que millor coincideix amb les dades de mostra (tipus bit, curt o llarg).

public uint[] SminSampleValue { get; set; }

Valor de la propietat

uint []

SoftwareType

Obté o estableix el tipus de programari.

public string SoftwareType { get; set; }

Valor de la propietat

string

StripByteCounts

Obtenir o establir la barra de bit comptes.

public ulong[] StripByteCounts { get; set; }

Valor de la propietat

ulong []

StripOffsets

Obtén o posa els despatxos de la barra.

public ulong[] StripOffsets { get; set; }

Valor de la propietat

ulong []

SubFileType

Obté o col·loca una indicació general del tipus de dades continguts en aquest subfile.

public TiffNewSubFileTypes SubFileType { get; set; }

Valor de la propietat

TiffNewSubFileTypes

TagCount

Obtenir el compte de la etiqueta.

public int TagCount { get; }

Valor de la propietat

int

Tags

Obtenir o posar les etiquetes.

public TiffDataType[] Tags { get; set; }

Valor de la propietat

TiffDataType []

TargetPrinter

Obté o col·loca la impresora objectiva.

public string TargetPrinter { get; set; }

Valor de la propietat

string

Threshholding

Obtenir o posar el fresc.

public TiffThresholds Threshholding { get; set; }

Valor de la propietat

TiffThresholds

TileByteCounts

Obtenir o establir el nombre de tile byte.

public ulong[] TileByteCounts { get; set; }

Valor de la propietat

ulong []

TileLength

Gets ot s’estableix la longitud de la tile.

public uint TileLength { get; set; }

Valor de la propietat

uint

TileOffsets

Obté o col·loca els despatxos de taula.

public ulong[] TileOffsets { get; set; }

Valor de la propietat

ulong []

TileWidth

Gets ot s’estableix l’amplada de tile.

public uint TileWidth { get; set; }

Valor de la propietat

uint

TotalPages

Obtenir les pàgines totals.

public ushort TotalPages { get; }

Valor de la propietat

ushort

ValidTagCount

Aquesta no és la xifra total de les etiquetes, sinó el nombre d’etiquetes que es poden conservar.

public int ValidTagCount { get; }

Valor de la propietat

int

Xpautor

Obtenir o configurar l’autor d’imatge, que s’utilitza per Windows Explorer.

public string XPAuthor { get; set; }

Valor de la propietat

string

xpComentari

Obté o posa comentaris sobre la imatge, que s’utilitza per Windows Explorer.

public string XPComment { get; set; }

Valor de la propietat

string

XPeywords

Obté o col·loca la imatge subjecte, que s’utilitza per Windows Explorer.

public string XPKeywords { get; set; }

Valor de la propietat

string

XPS Subjecte

Obté o col·loca informació sobre la imatge, que s’utilitza per Windows Explorer.

public string XPSubject { get; set; }

Valor de la propietat

string

Xtítol

Obté o col·loca informació sobre la imatge, que s’utilitza per Windows Explorer.

public string XPTitle { get; set; }

Valor de la propietat

string

Xposition

Obtenir o establir la posició x.

public TiffRational Xposition { get; set; }

Valor de la propietat

TiffRational

Xresolution

Obtenir o establir la resolució x.

public TiffRational Xresolution { get; set; }

Valor de la propietat

TiffRational

YCbCrCoeficients

Obté o estableix els coeficients de YCbCr.

public TiffRational[] YCbCrCoefficients { get; set; }

Valor de la propietat

TiffRational []

Exceptions

TiffImageException

El nombre de coeficients racionals ha de ser igual a 3.

ArgumentNullException

Valor

ICbCrSubsamblació

Obté o col·loca els factors subsampling per a YCbCr fotometric.

public ushort[] YCbCrSubsampling { get; set; }

Valor de la propietat

ushort []

Examples

Aquest exemple mostra com salvar una imatge de raster al format TIFF utilitzant diverses opcions.

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

                                                                                                  Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                                                                                                  // Set 8 bits for each color component.
                                                                                                  saveOptions.BitsPerSample = new ushort[] { 8, 8, 8 };

                                                                                                  // Set the Big Endian byte order (Motorola)
                                                                                                  saveOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;

                                                                                                  // Set the LZW compression.
                                                                                                  saveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;

                                                                                                  // Allow to reduce the size of continuous-tone images.
                                                                                                  // Currently this field is used only with LZW encoding because LZW is probably the only TIFF encoding scheme
                                                                                                  // that benefits significantly from a predictor step.
                                                                                                  saveOptions.Predictor = Imaging.FileFormats.Tiff.Enums.TiffPredictor.Horizontal;

                                                                                                  // Set the RGB color model.
                                                                                                  saveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;

                                                                                                  // For YCbCr, you can use one of the following choices:
                                                                                                  // YCbCrSubSampling field   JPEG sampling factors
                                                                                                  // ----------------------------------------------
                                                                                                  // 1,1                      1x1, 1x1, 1x1
                                                                                                  // 2,1                      2x1, 1x1, 1x1
                                                                                                  // 2,2(default value)       2x2, 1x1, 1x1
                                                                                                  // saveOptions.YCbCrSubsampling = new ushort[] { 2, 2 };

                                                                                                  // All color components will be stored within a singel plane.
                                                                                                  saveOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;

                                                                                                  // Create a TIFF Frame of 100x100 px.
                                                                                                  using (Aspose.Imaging.Image image = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                  {
                                                                                                      // Fill the entire image 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(image.Width, image.Height),
                                                                                                              Aspose.Imaging.Color.Blue,
                                                                                                              Aspose.Imaging.Color.Yellow);

                                                                                                      Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
                                                                                                      graphics.FillRectangle(gradientBrush, image.Bounds);

                                                                                                      image.Save(dir + "output.tif", saveOptions);
                                                                                                  }

Exceptions

TiffImageException

La longitud del camp Invalid. El camp d’assemblació YCbCr ha de contenir dos valors.

ArgumentNullException

Valor

Yposition

Obtenir o posar la posició y.

public TiffRational Yposition { get; set; }

Valor de la propietat

TiffRational

Yresolution

Obtenir o establir la resolució.

public TiffRational Yresolution { get; set; }

Valor de la propietat

TiffRational

Methods

AddTag(TiffDataType)

Afegeix una nova etiqueta.

public void AddTag(TiffDataType tagToAdd)

Parameters

tagToAdd TiffDataType

La etiqueta per afegir.

AddTags(TiffDataType[])

Afegeix les etiquetes.

public void AddTags(TiffDataType[] tagsToAdd)

Parameters

tagsToAdd TiffDataType []

Les etiquetes per afegir.

Clone()

Cloneu aquesta instància.

public override ImageOptionsBase Clone()

Returns

ImageOptionsBase

Torna una clona profunda.

GetTagByType(TiffTags)

Obté l’exemple de la etiqueta per tipus.

public TiffDataType GetTagByType(TiffTags tagKey)

Parameters

tagKey TiffTags

La clau de la tag.

Returns

TiffDataType

Instància de la etiqueta si existeix o no d’una altra manera.

GetValidTagsCount(TiffDataType[])

Obtenir el compte de les etiquetes vàlides.

public static int GetValidTagsCount(TiffDataType[] tags)

Parameters

tags TiffDataType []

Les etiquetes per validar.

Returns

int

Les etiquetes valides són comptades.

IsTagPresent(TiffTags)

Determina si la etiqueta està present en les opcions o no.

public bool IsTagPresent(TiffTags tag)

Parameters

tag TiffTags

La etiqueta ID per comprovar.

Returns

bool

‘verdadera’ si la etiqueta és present; d’altra banda, ‘falsa’.

RemoveTag(TiffTags)

Elimina la etiqueta.

public bool RemoveTag(TiffTags tag)

Parameters

tag TiffTags

El rècord per eliminar.

Returns

bool

És cert si s’elimina amb èxit

RemoveTags(Títol TiffTags[])

Retirar les etiquetes.

public bool RemoveTags(params TiffTags[] tags)

Parameters

tags TiffTags []

Les etiquetes per eliminar.

Returns

bool

Veritat Si la mida de la col·lecció d’etiquetes canvia.

Validate()

Valida si les opcions tenen una combinació vàlida de etiquetes

public void Validate()
 Català