Class TiffOptions
Το όνομα: Aspose.Imaging.ImageOptions Συγκέντρωση: Aspose.Imaging.dll (25.4.0)
Οι επιλογές μορφοποίησης αρχείων tiff.Σημειώστε ότι οι ετικέτες πλάτος και ύψους θα υπεργραφούν στη δημιουργία εικόνας με τις παραμέτρους πλάτους και ύψους, οπότε δεν υπάρχει καμία ανάγκη να τις προσδιορίσετε απευθείας.Σημειώστε ότι πολλές επιλογές επιστρέφουν μια προεπιλεγμένη τιμή, αλλά αυτό δεν σημαίνει ότι αυτή η επιλογή ρυθμίζεται ρητά ως τιμή ετικέτας.
[JsonObject(MemberSerialization.OptIn)]
public class TiffOptions : ImageOptionsBase, IDisposable, ICloneable, IHasExifData, IHasXmpData, IHasMetadata
Inheritance
object ← DisposableObject ← ImageOptionsBase ← TiffOptions
Derived
Implements
IDisposable , ICloneable , IHasExifData , IHasXmpData , IHasMetadata
Κληρονομημένα μέλη
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
Αυτό το παράδειγμα δείχνει τη χρήση διαφορετικών τάξεων από το SaveOptions Namespace για σκοπούς εξαγωγής. Μια εικόνα τύπου Gif φορτώνεται σε μια περίπτωση εικόνας και στη συνέχεια εξάγεται σε διάφορες μορφές.
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));
}
Το παρακάτω παράδειγμα δείχνει πώς να μετατρέψετε μια εικόνα πολλαπλών σελίδων σε μορφή TIFF γενικά χωρίς να αναφέρετε σε έναν συγκεκριμένο τύπο εικόνας.
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);
}
Αυτά τα παραδείγματα χρησιμοποιούν την κατηγορία GraphicsPath και Graphics για να δημιουργήσουν και να χειραγωγήσουν Σημάδια σε μια επιφάνεια εικόνας. Το παράδειγμα δημιουργεί μια νέα εικόνα (του τύπου Tiff), καθαρίζει την επιφάνεια και τραβάει τα μονοπάτια με τη βοήθεια της κατηγορίας GraphicsPath. Στο τέλος, η μέθοδος DrawPath που εκτίθεται από την κατηγορία Graphics καλείται να κάνει τα μονοπάτια στην επιφάνεια.
//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(Τίτλερ, Τίτλερ, Τίτλερ)
Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.ImageOptions.TiffOptions.
public TiffOptions(TiffExpectedFormat expectedFormat, TiffByteOrder byteOrder)
Parameters
expectedFormat
TiffExpectedFormat
Η αναμενόμενη μορφή αρχείου tiff.
byteOrder
TiffByteOrder
Η μορφή αρχείου tiff byte παραγγελία για χρήση.
TiffOptions(TiffExpectedFormat)
Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.ImageOptions.TiffOptions. Κατά προεπιλογή χρησιμοποιείται μικρή σύμβαση.
public TiffOptions(TiffExpectedFormat expectedFormat)
Parameters
expectedFormat
TiffExpectedFormat
Η αναμενόμενη μορφή αρχείου tiff.
Examples
Το παρακάτω παράδειγμα δείχνει πώς να δημιουργήσετε ένα αντίγραφο γκρίζας ενός υπάρχοντος πλαισίου και να το προσθέσετε σε μια εικόνα 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();
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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)
Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.ImageOptions.TiffOptions.
public TiffOptions(TiffOptions options)
Parameters
options
TiffOptions
Οι επιλογές για να αντιγράψετε.
TiffOptions(TiffDataType[])
Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.ImageOptions.TiffOptions.
public TiffOptions(TiffDataType[] tags)
Parameters
tags
TiffDataType
[ ]
Οι ετικέτες για να ξεκινήσετε τις επιλογές με.
Properties
AlphaStorage
Μπορείτε να πάρετε ή να ρυθμίσετε την επιλογή αποθήκευσης alpha. επιλογές διαφορετικές από Aspose.Imaging.FileFormats.Tiff.Enums.TiffAlphaStorage.Unspecifiedχρησιμοποιούνται όταν υπάρχουν περισσότερα από 3 Aspose.Imaging.ImageOptions.TiffOptions.SamplesPerPixel ορισμένο.
public TiffAlphaStorage AlphaStorage { get; set; }
Αξία ιδιοκτησίας
Artist
Να πάρει ή να βάλει τον καλλιτέχνη.
public string Artist { get; set; }
Αξία ιδιοκτησίας
BitsPerPixel
Πάρτε τα bit ανά pixel.
public int BitsPerPixel { get; }
Αξία ιδιοκτησίας
BitsPerSample
Πάρτε ή τοποθετήστε τα bit ανά δείγμα.
public ushort[] BitsPerSample { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF από το scratch και να την αποθηκεύσετε σε ένα αρχείο.
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");
}
Το παρακάτω παράδειγμα δείχνει πώς να συνθέσετε ένα TIFF από ατομικές εικόνες ράστερ.
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();
}
Το παρακάτω παράδειγμα δείχνει πώς να δημιουργήσετε ένα αντίγραφο γκρίζας ενός υπάρχοντος πλαισίου και να το προσθέσετε σε μια εικόνα 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();
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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);
}
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με 2 πλαίσια και να την αποθηκεύσετε σε ένα αρχείο.
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
Όταν ρυθμίζετε αυτή την τιμή, να θυμάστε ότι θα ρυθμίζει επίσης την τιμή SamplesPerPixel για το μήκος της σειράς. Αυτές οι 2 ιδιότητες είναι πολύ στενά συνδεδεμένες, έτσι ώστε να μπορεί να ρυθμίζεται ολοκληρωτικά μόνο.
ByteOrder
Αποκτά ή καθορίζει μια τιμή που υποδεικνύει την παραγγελία tiff byte.
public TiffByteOrder ByteOrder { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF από το scratch και να την αποθηκεύσετε σε ένα αρχείο.
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");
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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);
}
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με 2 πλαίσια και να την αποθηκεύσετε σε ένα αρχείο.
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
Αποκτήστε ή τοποθετήστε τον χρωματικό χάρτη.
public ushort[] ColorMap { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Exceptions
Αξία
Ο χάρτης χρώματος μπορεί να οριστεί για δείγματα ανά pixel ισοδύναμα με 1 μόνο.ήΤα bit ανά δείγμα δεν καθορίζονται.
Το μήκος της γραμμής πρέπει να αντιστοιχεί στη φόρμουλα παρακολούθησης: 3 * (2**BitsPerSample).
CompressedQuality
Αποκτά ή ρυθμίζει συμπιεσμένη ποιότητα εικόνας.Χρησιμοποιείται με τη συμπίεση JPEG.
public int CompressedQuality { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με τη συμπίεση Jpeg και την προσδιορισμένη ποιότητα συμπιεσμένης εικόνας.
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
Πάρτε ή τοποθετήστε την συμπίεση.
public TiffCompressions Compression { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF από το scratch και να την αποθηκεύσετε σε ένα αρχείο.
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");
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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);
}
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με 2 πλαίσια και να την αποθηκεύσετε σε ένα αρχείο.
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
Αποκτά ή θέτει τα πνευματικά δικαιώματα.
public string Copyright { get; set; }
Αξία ιδιοκτησίας
DateTime
Αποκτήστε ή καθορίστε την ημερομηνία και την ώρα.
public string DateTime { get; set; }
Αξία ιδιοκτησίας
DefaultMemoryAllocationLimit
Αποκτά ή θέτει το προεπιλεγμένο όριο κατανομής μνήμης.
[Obsolete("Use Aspose.Imaging.Image.BufferSizeHint, Aspose.Imaging.ImageOptionsBase.BufferSizeHint or Aspose.Imaging.LoadOptions.BufferSizeHint instead.")]
public int DefaultMemoryAllocationLimit { get; set; }
Αξία ιδιοκτησίας
DisableIccExport
Αποκτά ή καθορίζει μια τιμή που υποδεικνύει αν η εξαγωγή προφίλ ICC είναι απενεργοποιημένη (το προφίλ ICC εφαρμόζεται εκ των προτέρων στα αρχικά pixels).
[JsonProperty]
public bool DisableIccExport { get; set; }
Αξία ιδιοκτησίας
DocumentName
Αποκτά ή θέτει το όνομα του εγγράφου.
public string DocumentName { get; set; }
Αξία ιδιοκτησίας
ExifData
Αποκτά ή συλλέγει δεδομένα Exif.
public ExifData ExifData { get; set; }
Αξία ιδιοκτησίας
ExifIfd
Αποκτήστε ή τοποθετήστε τον δείκτη στο EXIF IFD.
public TiffExifIfd ExifIfd { get; }
Αξία ιδιοκτησίας
ExtraSamples
Πάρτε τα επιπλέον δείγματα αξιών.
public ushort[] ExtraSamples { get; }
Αξία ιδιοκτησίας
ushort [ ]
FaxT4Options
Αποκτήστε ή τοποθετήστε τις επιλογές φαξ t4.
public Group3Options FaxT4Options { get; set; }
Αξία ιδιοκτησίας
FileStandard
Αποκτά ή ρυθμίζει το πρότυπο αρχείου TIFF.
public TiffFileStandards FileStandard { get; set; }
Αξία ιδιοκτησίας
FillOrder
Αποκτήστε ή τοποθετήστε το byte bit για να συμπληρώσετε την παραγγελία.
public TiffFillOrders FillOrder { get; set; }
Αξία ιδιοκτησίας
HalfToneHints
Πάρτε ή τοποθετήστε τα μισά σημάδια.
public ushort[] HalfToneHints { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Exceptions
Αξία
Αξία: Το μήκος της γραμμής πρέπει να είναι ίσο με 2.
IccProfile
Αποκτά ή ρυθμίζει την ροή του προφίλ Icc.
public MemoryStream IccProfile { get; set; }
Αξία ιδιοκτησίας
ImageDescription
Αποκτά ή τοποθετεί την περιγραφή της εικόνας.
public string ImageDescription { get; set; }
Αξία ιδιοκτησίας
ImageLength
Αποκτά ή ρυθμίζει το μήκος της εικόνας.
public uint ImageLength { get; set; }
Αξία ιδιοκτησίας
ImageWidth
Αποκτά ή ρυθμίζει το πλάτος της εικόνας.
public uint ImageWidth { get; set; }
Αξία ιδιοκτησίας
InkNames
Αποκτήστε ή τοποθετήστε τα ονόματα των ενυδρείων.
public string InkNames { get; set; }
Αξία ιδιοκτησίας
IsExtraSamplesPresent
Παίρνει μια τιμή που υποδεικνύει αν τα επιπλέον δείγματα είναι παρόντα.
public bool IsExtraSamplesPresent { get; }
Αξία ιδιοκτησίας
IsTiled
Αποκτά μια τιμή που υποδεικνύει αν η εικόνα είναι τυλιγμένη.
public bool IsTiled { get; }
Αξία ιδιοκτησίας
IsValid
Αποκτά μια τιμή που υποδεικνύει αν το Aspose.Imaging.ImageOptions.TiffOptions έχουν ρυθμιστεί σωστά.
public bool IsValid { get; }
Αξία ιδιοκτησίας
MaxSampleValue
Αποκτά ή καθορίζει τη μέγιστη τιμή δείγματος.
public ushort[] MaxSampleValue { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Exceptions
Αξία
Αξία: Το μήκος της γραμμής πρέπει να αντιστοιχεί στα δείγματα ανά αριθμό pixel.
MinSampleValue
Αποκτά ή καθορίζει την τιμή του δείγματος.
public ushort[] MinSampleValue { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Exceptions
Αξία
Αξία: Το μήκος της γραμμής πρέπει να αντιστοιχεί στα δείγματα ανά αριθμό pixel.
Orientation
Να πάρει ή να καθορίσει την προσανατολισμό.
public TiffOrientations Orientation { get; set; }
Αξία ιδιοκτησίας
PageName
Αποκτήστε ή τοποθετήστε το όνομα της σελίδας.
public string PageName { get; set; }
Αξία ιδιοκτησίας
PageNumber
Αποκτήστε ή τοποθετήστε την ετικέτα αριθμός σελίδας.
public ushort[] PageNumber { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Exceptions
Αξία
Αξία;Προσδόκησε 2 τιμές στη σειρά: PageNumber[0] είναι ο αριθμός σελίδας και PageNumber[1] είναι ο συνολικός αριθμός σελίδων στο έγγραφο.
Palette
Πάρτε ή τοποθετήστε το χρώμα παλέτα.
public override IColorPalette Palette { get; set; }
Αξία ιδιοκτησίας
Photometric
Πάρτε ή τοποθετήστε τη φωτομετρία.
public TiffPhotometrics Photometric { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF από το scratch και να την αποθηκεύσετε σε ένα αρχείο.
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");
}
Το παρακάτω παράδειγμα δείχνει πώς να συνθέσετε ένα TIFF από ατομικές εικόνες ράστερ.
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();
}
Το παρακάτω παράδειγμα δείχνει πώς να δημιουργήσετε ένα αντίγραφο γκρίζας ενός υπάρχοντος πλαισίου και να το προσθέσετε σε μια εικόνα 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();
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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);
}
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με 2 πλαίσια και να την αποθηκεύσετε σε ένα αρχείο.
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
Αποκτά ή ρυθμίζει τη διαμόρφωση του σχεδίου.
public TiffPlanarConfigs PlanarConfiguration { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF από το scratch και να την αποθηκεύσετε σε ένα αρχείο.
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");
}
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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);
}
Αυτό το παράδειγμα δείχνει πώς να δημιουργήσετε μια εικόνα TIFF με 2 πλαίσια και να την αποθηκεύσετε σε ένα αρχείο.
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
Αποκτά ή τοποθετεί τον προβολέα για την συμπίεση LZW.
public TiffPredictor Predictor { get; set; }
Αξία ιδιοκτησίας
Examples
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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
Αποκτά ή καθορίζει μια τιμή που υποδεικνύει εάν τα συστατικά πρέπει να προελαχιστούν.
[JsonProperty]
public bool PremultiplyComponents { get; set; }
Αξία ιδιοκτησίας
ResolutionSettings
Αποκτά ή ρυθμίζει τις ρυθμίσεις επίλυσης.
public override ResolutionSetting ResolutionSettings { get; set; }
Αξία ιδιοκτησίας
ResolutionUnit
Αποκτά ή τοποθετεί την μονάδα επίλυσης.
public TiffResolutionUnits ResolutionUnit { get; set; }
Αξία ιδιοκτησίας
RowsPerStrip
Πάρτε ή τοποθετήστε τις γραμμές ανά γραμμή.
public uint RowsPerStrip { get; set; }
Αξία ιδιοκτησίας
SampleFormat
Αποκτά ή τοποθετεί τη μορφή δείγματος.
public TiffSampleFormats[] SampleFormat { get; set; }
Αξία ιδιοκτησίας
Exceptions
Αξία
Αξία: Το μήκος της γραμμής πρέπει να αντιστοιχεί στα δείγματα ανά αριθμό pixel.
SamplesPerPixel
Για να αλλάξετε αυτή την αξία ιδιοκτησίας χρησιμοποιήστε το Aspose.Imaging.ImageOptions.TiffOptions.BitsPerSample ιδιοκτησία setter.
public ushort SamplesPerPixel { get; }
Αξία ιδιοκτησίας
ScannerManufacturer
Αποκτήστε ή τοποθετήστε τον κατασκευαστή σαρωτή.
public string ScannerManufacturer { get; set; }
Αξία ιδιοκτησίας
ScannerModel
Αποκτήστε ή τοποθετήστε το μοντέλο σαρωτή.
public string ScannerModel { get; set; }
Αξία ιδιοκτησίας
SmaxSampleValue
Η τιμή έχει έναν τύπο πεδίου που ταιριάζει καλύτερα με τα δεδομένα δείγματος (Byte, Short ή Long τύπο).
public uint[] SmaxSampleValue { get; set; }
Αξία ιδιοκτησίας
uint [ ]
SminSampleValue
Η τιμή έχει έναν τύπο πεδίου που ταιριάζει καλύτερα με τα δεδομένα δείγματος (Byte, Short ή Long τύπο).
public uint[] SminSampleValue { get; set; }
Αξία ιδιοκτησίας
uint [ ]
SoftwareType
Αποκτά ή ρυθμίζει τον τύπο λογισμικού.
public string SoftwareType { get; set; }
Αξία ιδιοκτησίας
StripByteCounts
Αποκτά ή τοποθετεί τη γραμμή byte μετρήσεις.
public ulong[] StripByteCounts { get; set; }
Αξία ιδιοκτησίας
ulong [ ]
StripOffsets
Πάρτε ή τοποθετήστε τα αποσπάσματα της γραμμής.
public ulong[] StripOffsets { get; set; }
Αξία ιδιοκτησίας
ulong [ ]
SubFileType
λαμβάνει ή καθορίζει μια γενική ένδειξη του είδους των δεδομένων που περιέχονται σε αυτό το υποφίλ.
public TiffNewSubFileTypes SubFileType { get; set; }
Αξία ιδιοκτησίας
TagCount
Παρουσιάζει τον αριθμό.
public int TagCount { get; }
Αξία ιδιοκτησίας
Tags
Αποκτήστε ή τοποθετήστε τις ετικέτες.
public TiffDataType[] Tags { get; set; }
Αξία ιδιοκτησίας
TiffDataType [ ]
TargetPrinter
Αποκτήστε ή τοποθετήστε τον στόχο εκτυπωτή.
public string TargetPrinter { get; set; }
Αξία ιδιοκτησίας
Threshholding
Πάρτε ή τοποθετήστε το φρέσκο.
public TiffThresholds Threshholding { get; set; }
Αξία ιδιοκτησίας
TileByteCounts
Πάρτε ή τοποθετήστε τον αριθμό των μύθων.
public ulong[] TileByteCounts { get; set; }
Αξία ιδιοκτησίας
ulong [ ]
TileLength
Πρέπει να βγάζουμε το μήκος του.
public uint TileLength { get; set; }
Αξία ιδιοκτησίας
TileOffsets
Πάρτε ή τοποθετήστε τα αποσπάσματα.
public ulong[] TileOffsets { get; set; }
Αξία ιδιοκτησίας
ulong [ ]
TileWidth
Πρέπει να βγάζουμε πλάτος.
public uint TileWidth { get; set; }
Αξία ιδιοκτησίας
TotalPages
Πάρτε τις συνολικές σελίδες.
public ushort TotalPages { get; }
Αξία ιδιοκτησίας
ValidTagCount
Αυτό δεν είναι ο συνολικός αριθμός των ετικετών, αλλά ο αριθμός των ετικετών που μπορούν να διατηρηθούν.
public int ValidTagCount { get; }
Αξία ιδιοκτησίας
XΠΟΥΡΓΟΣ
Αποκτά ή ρυθμίζει τον συγγραφέα εικόνας, το οποίο χρησιμοποιείται από το Windows Explorer.
public string XPAuthor { get; set; }
Αξία ιδιοκτησίας
ΠΡΟΣΟΧΗ
Αποκτά ή δίνει σχόλια για την εικόνα, η οποία χρησιμοποιείται από το Windows Explorer.
public string XPComment { get; set; }
Αξία ιδιοκτησίας
Ετικέτες XPKeywords
Αποκτά ή ρυθμίζει την υποκείμενο εικόνα, η οποία χρησιμοποιείται από το Windows Explorer.
public string XPKeywords { get; set; }
Αξία ιδιοκτησίας
Ετικέτες XPSUBject
Αποκτά ή τοποθετεί πληροφορίες σχετικά με την εικόνα, η οποία χρησιμοποιείται από το Windows Explorer.
public string XPSubject { get; set; }
Αξία ιδιοκτησίας
XΠΤΙΤΛ
Αποκτά ή τοποθετεί πληροφορίες σχετικά με την εικόνα, η οποία χρησιμοποιείται από το Windows Explorer.
public string XPTitle { get; set; }
Αξία ιδιοκτησίας
Xposition
Αποκτά ή τοποθετεί τη θέση x.
public TiffRational Xposition { get; set; }
Αξία ιδιοκτησίας
Xresolution
Αποκτήστε ή τοποθετήστε την ανάλυση x.
public TiffRational Xresolution { get; set; }
Αξία ιδιοκτησίας
YCbCrΚατάσταση
Αποκτά ή ρυθμίζει τους YCbCrCoefficients.
public TiffRational[] YCbCrCoefficients { get; set; }
Αξία ιδιοκτησίας
TiffRational [ ]
Exceptions
Ο αριθμός των ορθολογικών συντελεστών πρέπει να είναι ισοδύναμος με 3.
Αξία
ΚΕΦΑΛΑΙΟΔΗΛΕΥΣΗ
Αποκτά ή τοποθετεί τους παράγοντες υποσύνθεσης για το φωτομετρικό YCbCr.
public ushort[] YCbCrSubsampling { get; set; }
Αξία ιδιοκτησίας
ushort [ ]
Examples
Αυτό το παράδειγμα δείχνει πώς να αποθηκεύσετε μια εικόνα raster στη μορφή TIFF χρησιμοποιώντας διάφορες επιλογές.
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
Διάρκεια πεδίου Invalid. Το πεδίο YCbCrSubsampling πρέπει να περιέχει δύο τιμές.
Αξία
Yposition
Πάρτε ή τοποθετήστε τη θέση Y.
public TiffRational Yposition { get; set; }
Αξία ιδιοκτησίας
Yresolution
Να πάρει ή να καθορίσει την απόφαση.
public TiffRational Yresolution { get; set; }
Αξία ιδιοκτησίας
Methods
AddTag(TiffDataType)
Προσθέστε ένα νέο tag.
public void AddTag(TiffDataType tagToAdd)
Parameters
tagToAdd
TiffDataType
Η ετικέτα για να προσθέσετε.
AddTags(TiffDataType[])
Προσθέστε τα tags.
public void AddTags(TiffDataType[] tagsToAdd)
Parameters
tagsToAdd
TiffDataType
[ ]
Οι ετικέτες για να προσθέσετε.
Clone()
Κλωνοποιήστε αυτή την περίπτωση.
public override ImageOptionsBase Clone()
Returns
Επιστρέφει μια βαθιά κλωνοποίηση.
GetTagByType(TiffTags)
Πάρτε το παράδειγμα της ετικέτας ανά τύπο.
public TiffDataType GetTagByType(TiffTags tagKey)
Parameters
tagKey
TiffTags
Το κλειδί του tag.
Returns
Εξαίρεση της ετικέτας αν υπάρχει ή μη διαφορετικά.
GetValidTagsCount(TiffDataType[])
Αποκτήστε τον αριθμό των έγκυρων ετικετών.
public static int GetValidTagsCount(TiffDataType[] tags)
Parameters
tags
TiffDataType
[ ]
Οι ετικέτες για να επικυρωθούν.
Returns
Τα έγκυρα ετικέτα υπολογίζονται.
IsTagPresent(TiffTags)
Προσδιορίζει αν το ετικέτα είναι παρόν στις επιλογές ή όχι.
public bool IsTagPresent(TiffTags tag)
Parameters
tag
TiffTags
Το ID για να ελέγξετε.
Returns
«Αληθινή» αν η ετικέτα είναι παρούσα, αλλιώς «ψεύτικη».
RemoveTag(TiffTags)
Αφαιρέστε την ετικέτα.
public bool RemoveTag(TiffTags tag)
Parameters
tag
TiffTags
Η ετικέτα για να αφαιρεθεί.
Returns
Αλήθεια αν απομακρυνθεί με επιτυχία
RemoveTags(ΠΑΡΑΣΙΟΙ ΤΙΦΤΑΓΚΙ[])
Αφαιρέστε τις ετικέτες.
public bool RemoveTags(params TiffTags[] tags)
Parameters
tags
TiffTags
[ ]
Οι ετικέτες για να αφαιρέσετε.
Returns
αληθινό Αν αλλάξει το μέγεθος της συλλογής.
Validate()
Επιβεβαιώνει εάν οι επιλογές έχουν έγκυρο συνδυασμό ετικετών
public void Validate()