Class ImageSaveOptions

Class ImageSaveOptions

Nazwa przestrzeń: Aspose.Note.Saving Zgromadzenie: Aspose.Note.dll (25.4.0)

Pozwala określić dodatkowe opcje podczas renderowania stron dokumentów do obrazów.

public class ImageSaveOptions : SaveOptions

Inheritance

object SaveOptions ImageSaveOptions

Dziedziczeni członkowie

SaveOptions.SaveFormat , SaveOptions.FontsSubsystem , SaveOptions.PageIndex , SaveOptions.PageCount , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Pokaż, jak zapisać dokument jako obraz w formacie JPEG za pomocą programu SaveFormat.

// The path to the documents directory.
                                                                                 string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                 // Load the document into Aspose.Note.
                                                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                 dataDir = dataDir + "SaveToJpegImageUsingSaveFormat_out.jpg";

                                                                                 // Save the document.
                                                                                 oneFile.Save(dataDir, SaveFormat.Jpeg);

Pokaż, jak ustawić jakość obrazu podczas przechowywania dokumentu w formie JPEG.

// The path to the documents directory.
                                                                                         string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                         // Load the document into Aspose.Note.
                                                                                         Document doc = new Document(dataDir + "Aspose.one");

                                                                                         dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                                         // Save the document.
                                                                                         doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });

Pokaż, jak zapisać dokument jako obraz w formacie Bmp za pomocą opcji ImageSaveOptions.

// The path to the documents directory.
                                                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                      // Load the document into Aspose.Note.
                                                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                      dataDir = dataDir + "SaveToBmpImageUsingImageSaveOptions_out.bmp";

                                                                                      // Save the document.
                                                                                      oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));

Pokaż, jak ustawić rozdzielczość obrazu podczas przechowywania dokumentu jako obraz.

// The path to the documents directory.
                                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                             // Load the document into Aspose.Note.
                                                                             Document doc = new Document(dataDir + "Aspose.one");

                                                                             dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                             // Save the document.
                                                                             doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = 220 });

Pokaż, jak zapisać dokument jako obraz grayscale.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Load the document into Aspose.Note.
                                                           Document oneFile = new Document(dataDir + "Aspose.one");

                                                           dataDir = dataDir + "SaveAsGrayscaleImage_out.png";

                                                           // Save the document as gif.
                                                           oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                     {
                                                                                         ColorMode = ColorMode.GrayScale
                                                                                     });

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji PackBits.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Load the document into Aspose.Note.
                                                                                           Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                           var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");

                                                                                           // Save the document.
                                                                                           oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                 {
                                                                                                                     TiffCompression = TiffCompression.PackBits
                                                                                                                 });

Pokaż, jak zaoszczędzić notebook jako obraz z określonymi opcjami.

// The path to the documents directory.
                                                                      string dataDir = RunExamples.GetDataDir_NoteBook();

                                                                      // Load a OneNote Notebook
                                                                      var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");

                                                                      var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);

                                                                      var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;

                                                                      documentSaveOptions.Resolution = 400;

                                                                      dataDir = dataDir + "ConvertToImageWithOptions_out.png";

                                                                      // Save the Notebook
                                                                      notebook.Save(dataDir, notebookSaveOptions);

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji Jpeg.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                       // Load the document into Aspose.Note.
                                                                                       Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                       var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");

                                                                                       // Save the document.
                                                                                       oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                             {
                                                                                                                 TiffCompression = TiffCompression.Jpeg,
                                                                                                                 Quality = 93
                                                                                                             });

Pokaż, jak zaoszczędzić płaski notebook jako obraz.

// The path to the documents directory.
                                                         string dataDir = RunExamples.GetDataDir_NoteBook();

                                                         // Load a OneNote Notebook
                                                         var notebook = new Notebook(dataDir + "Notizbuch öffnen.onetoc2");

                                                         var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);

                                                         var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;

                                                         documentSaveOptions.Resolution = 400;
                                                         notebookSaveOptions.Flatten = true;

                                                         dataDir = dataDir + "ConvertToImageAsFlattenedNotebook_out.png";

                                                         // Save the Notebook
                                                         notebook.Save(dataDir, notebookSaveOptions);

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji faksu CCITT Group 3.

// The path to the documents directory.
                                                                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                    // Load the document into Aspose.Note.
                                                                                                    Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                    var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");

                                                                                                    // Save the document.
                                                                                                    oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                          {
                                                                                                                              ColorMode = ColorMode.BlackAndWhite,
                                                                                                                              TiffCompression = TiffCompression.Ccitt3
                                                                                                                          });

Pokaż, jak zapisać dokument w formacie png.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      // Initialize ImageSaveOptions object 
                                                      ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png)
                                                                                  {
                                                                                      // Set page index
                                                                                      PageIndex = 1
                                                                                  };

                                                      dataDir = dataDir + "ConvertSpecificPageToImage_out.png";

                                                      // Save the document as PNG.
                                                      oneFile.Save(dataDir, opts);

Pokaż, jak zaoszczędzić dokument jako obraz binarny za pomocą metody Otsu.

// The path to the documents directory.
                                                                            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                            // Load the document into Aspose.Note.
                                                                            Document oneFile = new Document(dataDir + "Aspose.one");

                                                                            dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                            // Save the document as gif.
                                                                            oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                    {
                                                                                                        ColorMode = ColorMode.BlackAndWhite,
                                                                                                        BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                              {
                                                                                                                                  BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                              }
                                                                                                    });

Pokazuje, jak zaoszczędzić dokument jako obraz binarny za pomocą stałego próg.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

Constructors

ImageSaveOptions(SaveFormat)

Inicjalizuje nową instancję klasy Aspose.Note.Saving.ImageSaveOptions.

public ImageSaveOptions(SaveFormat format)

Parameters

format SaveFormat

Format, w którym dokument jest zapisywany.

Properties

BinarizationOptions

Otrzymuje lub ustawia opcje dla binaryzacji obrazu.

public ImageBinarizationOptions BinarizationOptions { get; set; }

Wartość nieruchomości

ImageBinarizationOptions

Examples

Pokaż, jak zaoszczędzić dokument jako obraz binarny za pomocą metody Otsu.

// The path to the documents directory.
                                                                            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                            // Load the document into Aspose.Note.
                                                                            Document oneFile = new Document(dataDir + "Aspose.one");

                                                                            dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                            // Save the document as gif.
                                                                            oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                    {
                                                                                                        ColorMode = ColorMode.BlackAndWhite,
                                                                                                        BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                              {
                                                                                                                                  BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                              }
                                                                                                    });

Pokazuje, jak zaoszczędzić dokument jako obraz binarny za pomocą stałego próg.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

ColorMode

Otrzymuje lub ustawia Aspose.Note.Saving.ImageSaveOptions.ColorMode dla obrazu wyjściowego.

public ColorMode ColorMode { get; set; }

Wartość nieruchomości

ColorMode

Examples

Pokaż, jak zapisać dokument jako obraz grayscale.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Load the document into Aspose.Note.
                                                           Document oneFile = new Document(dataDir + "Aspose.one");

                                                           dataDir = dataDir + "SaveAsGrayscaleImage_out.png";

                                                           // Save the document as gif.
                                                           oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                     {
                                                                                         ColorMode = ColorMode.GrayScale
                                                                                     });

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji faksu CCITT Group 3.

// The path to the documents directory.
                                                                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                    // Load the document into Aspose.Note.
                                                                                                    Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                    var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");

                                                                                                    // Save the document.
                                                                                                    oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                          {
                                                                                                                              ColorMode = ColorMode.BlackAndWhite,
                                                                                                                              TiffCompression = TiffCompression.Ccitt3
                                                                                                                          });

Pokaż, jak zaoszczędzić dokument jako obraz binarny za pomocą metody Otsu.

// The path to the documents directory.
                                                                            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                            // Load the document into Aspose.Note.
                                                                            Document oneFile = new Document(dataDir + "Aspose.one");

                                                                            dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                            // Save the document as gif.
                                                                            oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                    {
                                                                                                        ColorMode = ColorMode.BlackAndWhite,
                                                                                                        BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                              {
                                                                                                                                  BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                              }
                                                                                                    });

Pokazuje, jak zaoszczędzić dokument jako obraz binarny za pomocą stałego próg.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

Quality

Otrzymuje lub ustawia wartość określającą jakość zachowanego obrazu.Wartość ta jest przekazywana do kodeka jako parametr System.Drawing.Imacking.Encoder.Quality.

public int Quality { get; set; }

Wartość nieruchomości

int

Examples

Pokaż, jak ustawić jakość obrazu podczas przechowywania dokumentu w formie JPEG.

// The path to the documents directory.
                                                                                         string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                         // Load the document into Aspose.Note.
                                                                                         Document doc = new Document(dataDir + "Aspose.one");

                                                                                         dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                                         // Save the document.
                                                                                         doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji Jpeg.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                       // Load the document into Aspose.Note.
                                                                                       Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                       var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");

                                                                                       // Save the document.
                                                                                       oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                             {
                                                                                                                 TiffCompression = TiffCompression.Jpeg,
                                                                                                                 Quality = 93
                                                                                                             });

Remarks

Zakres wartości przydatnych dla kategorii jakości wynosi od 0 do 100.Im niższa jest określona liczba, tym wyższa jest kompresja i tym niższa jest jakość obrazu.Zero daje Ci najniższą jakość obrazu, a 100 najwyższym.Wartość zwykła wynosi 90.

Resolution

Otrzymuje lub ustawia rozdzielczość dla generowanych obrazów, w punktach na cala.

public float Resolution { get; set; }

Wartość nieruchomości

float

Examples

Pokaż, jak ustawić rozdzielczość obrazu podczas przechowywania dokumentu jako obraz.

// The path to the documents directory.
                                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                             // Load the document into Aspose.Note.
                                                                             Document doc = new Document(dataDir + "Aspose.one");

                                                                             dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                             // Save the document.
                                                                             doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = 220 });

Pokaż, jak zaoszczędzić notebook jako obraz z określonymi opcjami.

// The path to the documents directory.
                                                                      string dataDir = RunExamples.GetDataDir_NoteBook();

                                                                      // Load a OneNote Notebook
                                                                      var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");

                                                                      var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);

                                                                      var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;

                                                                      documentSaveOptions.Resolution = 400;

                                                                      dataDir = dataDir + "ConvertToImageWithOptions_out.png";

                                                                      // Save the Notebook
                                                                      notebook.Save(dataDir, notebookSaveOptions);

Pokaż, jak zaoszczędzić płaski notebook jako obraz.

// The path to the documents directory.
                                                         string dataDir = RunExamples.GetDataDir_NoteBook();

                                                         // Load a OneNote Notebook
                                                         var notebook = new Notebook(dataDir + "Notizbuch öffnen.onetoc2");

                                                         var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);

                                                         var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;

                                                         documentSaveOptions.Resolution = 400;
                                                         notebookSaveOptions.Flatten = true;

                                                         dataDir = dataDir + "ConvertToImageAsFlattenedNotebook_out.png";

                                                         // Save the Notebook
                                                         notebook.Save(dataDir, notebookSaveOptions);

Remarks

Wartość zwykła wynosi 96.

TiffCompression

Otrzymuje lub ustawia typ kompresji do użycia podczas przechowywania generowanych obrazów w formacie TIFF.

public TiffCompression TiffCompression { get; set; }

Wartość nieruchomości

TiffCompression

Examples

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji PackBits.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Load the document into Aspose.Note.
                                                                                           Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                           var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");

                                                                                           // Save the document.
                                                                                           oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                 {
                                                                                                                     TiffCompression = TiffCompression.PackBits
                                                                                                                 });

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji Jpeg.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                       // Load the document into Aspose.Note.
                                                                                       Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                       var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");

                                                                                       // Save the document.
                                                                                       oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                             {
                                                                                                                 TiffCompression = TiffCompression.Jpeg,
                                                                                                                 Quality = 93
                                                                                                             });

Pokaż, jak zapisać dokument jako obraz w formacie Tiff za pomocą kompresji faksu CCITT Group 3.

// The path to the documents directory.
                                                                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                    // Load the document into Aspose.Note.
                                                                                                    Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                    var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");

                                                                                                    // Save the document.
                                                                                                    oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                          {
                                                                                                                              ColorMode = ColorMode.BlackAndWhite,
                                                                                                                              TiffCompression = TiffCompression.Ccitt3
                                                                                                                          });
 Polski