Aspose::Words::Saving::ImageSaveOptions Class Reference

Detailed Description

Allows to specify additional options when rendering document pages or shapes to images.

Examples

Renders a page of a Word document into an image with transparent or colored background.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imgOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "PaperColor" property to a transparent color to apply a transparent
// background to the document while rendering it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_Transparent());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.Transparent.png", imgOptions);
// Set the "PaperColor" property to an opaque color to apply that color
// as the background of the document as we render it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_LightCoral());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.LightCoral.png", imgOptions);
static ASPOSECPP_SHARED_API Color get_LightCoral()
static ASPOSECPP_SHARED_API Color get_Transparent()
@ Png
Renders a page of the document and saves it as a PNG file.

Shows how to configure compression while saving a document as a JPEG.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Jpeg);
// Set the "JpegQuality" property to "10" to use stronger compression when rendering the document.
// This will reduce the file size of the document, but the image will display more prominent compression artifacts.
imageOptions->set_JpegQuality(10);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg", imageOptions);
ASSERT_GE(20000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg")->get_Length());
// Set the "JpegQuality" property to "100" to use weaker compression when rending the document.
// This will improve the quality of the image at the cost of an increased file size.
imageOptions->set_JpegQuality(100);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg", imageOptions);
ASSERT_LT(60000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg")->get_Length());
@ Jpeg
Renders a page of the document and saves it as a JPEG file.

Shows how to specify a resolution while rendering a document to PNG.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "Resolution" property to "72" to render the document in 72dpi.
options->set_Resolution(72.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png", options);
ASSERT_GE(120000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png")->get_Length());
// Set the "Resolution" property to "300" to render the document in 300dpi.
options->set_Resolution(300.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png", options);
ASSERT_LT(700000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png")->get_Length());

#include <Aspose.Words.Cpp/Model/Saving/ImageSaveOptions.h>

+ Inheritance diagram for Aspose::Words::Saving::ImageSaveOptions:

Public Member Functions

 ImageSaveOptions (SaveFormat saveFormat)
 Initializes a new instance of this class that can be used to save rendered images in the Tiff, Png, Bmp, Emf, Jpeg or Svg format. Png, Bmp, Jpeg or Svg format. More...
 
SharedPtr< ImageSaveOptionsClone ()
 Creates a deep clone of this object. More...
 
float get_HorizontalResolution () const
 Gets or sets the horizontal resolution for the generated images, in dots per inch. More...
 
float get_ImageBrightness () const
 Gets or sets the brightness for the generated images. More...
 
ImageColorMode get_ImageColorMode () const
 Gets or sets the color mode for the generated images. More...
 
float get_ImageContrast () const
 Gets or sets the contrast for the generated images. More...
 
int32_t get_JpegQuality ()
 Gets or sets a value determining the quality of the generated JPEG images. More...
 
SharedPtr< MetafileRenderingOptionsget_MetafileRenderingOptions ()
 Allows to specify how metafiles are treated in the rendered output. More...
 
SharedPtr< PageSetget_PageSet ()
 Gets or sets the pages to render. Default is all the pages in the document. More...
 
Color get_PaperColor ()
 Gets or sets the background (paper) color for the generated images. The default value is White. More...
 
ImagePixelFormat get_PixelFormat () const
 Gets or sets the pixel format for the generated images. More...
 
SaveFormat get_SaveFormat () override
 Specifies the format in which the rendered document pages or shapes will be saved if this save options object is used. Can be a raster Tiff, Png, Bmp, Jpeg or vector Emf, Svg. More...
 
float get_Scale () const
 Gets or sets the zoom factor for the generated images. More...
 
uint8_t get_ThresholdForFloydSteinbergDithering () const
 Gets or sets the threshold that determines the value of the binarization error in the Floyd-Steinberg method. when ImageBinarizationMethod is ImageBinarizationMethod.FloydSteinbergDithering. More...
 
ImageBinarizationMethod get_TiffBinarizationMethod () const
 Gets or sets method used while converting images to 1 bpp format when SaveFormat is SaveFormat.Tiff and TiffCompression is equal to TiffCompression.Ccitt3 or TiffCompression.Ccitt4. More...
 
TiffCompression get_TiffCompression () const
 Gets or sets the type of compression to apply when saving generated images to the TIFF format. More...
 
bool get_UseGdiEmfRenderer () const
 Gets or sets a value determining whether to use GDI+ or Aspose.Words metafile renderer when saving to EMF. More...
 
float get_VerticalResolution () const
 Gets or sets the vertical resolution for the generated images, in dots per inch. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_HorizontalResolution (float value)
 Setter for get_HorizontalResolution. More...
 
void set_ImageBrightness (float value)
 Setter for get_ImageBrightness. More...
 
void set_ImageColorMode (ImageColorMode value)
 Setter for get_ImageColorMode. More...
 
void set_ImageContrast (float value)
 Setter for get_ImageContrast. More...
 
void set_JpegQuality (int32_t value)
 Setter for get_JpegQuality. More...
 
void set_PageSet (SharedPtr< PageSet > value)
 Setter for get_PageSet. More...
 
void set_PaperColor (Color value)
 Setter for get_PaperColor. More...
 
void set_PixelFormat (ImagePixelFormat value)
 Setter for get_PixelFormat. More...
 
void set_Resolution (float value)
 Sets both horizontal and vertical resolution for the generated images, in dots per inch. More...
 
void set_SaveFormat (SaveFormat value) override
 Setter for get_SaveFormat. More...
 
void set_Scale (float value)
 Setter for get_Scale. More...
 
void set_ThresholdForFloydSteinbergDithering (uint8_t value)
 Setter for get_ThresholdForFloydSteinbergDithering. More...
 
void set_TiffBinarizationMethod (ImageBinarizationMethod value)
 Setter for get_TiffBinarizationMethod. More...
 
void set_TiffCompression (TiffCompression value)
 Setter for get_TiffCompression. More...
 
void set_UseGdiEmfRenderer (bool value)
 Setter for get_UseGdiEmfRenderer. More...
 
void set_VerticalResolution (float value)
 Setter for get_VerticalResolution. More...
 
- Public Member Functions inherited from FixedPageSaveOptions
bool Equals (SharedPtr< Object > obj) override
 Determines whether the specified object is equal in value to the current object. More...
 
ColorMode get_ColorMode () const
 Gets or sets a value determining how colors are rendered. More...
 
int32_t get_JpegQuality () const
 Gets or sets a value determining the quality of the JPEG images inside Html document. More...
 
SharedPtr< MetafileRenderingOptionsget_MetafileRenderingOptions () const
 Allows to specify metafile rendering options. More...
 
NumeralFormat get_NumeralFormat () const
 Gets or sets NumeralFormat used for rendering of numerals. European numerals are used by default. More...
 
virtual bool get_OptimizeOutput ()
 Flag indicates whether it is required to optimize output. If this flag is set redundant nested canvases and empty canvases are removed, also neighbor glyphs with the same formatting are concatenated. Note: The accuracy of the content display may be affected if this property is set to true. Default is false. More...
 
SharedPtr< IPageSavingCallbackget_PageSavingCallback () const
 Allows to control how separate pages are saved when a document is exported to fixed page format. More...
 
SharedPtr< PageSetget_PageSet () const
 Gets or sets the pages to render. Default is all the pages in the document. More...
 
void set_ColorMode (ColorMode value)
 Setter for get_ColorMode. More...
 
void set_JpegQuality (int32_t value)
 Setter for get_JpegQuality. More...
 
void set_MetafileRenderingOptions (SharedPtr< MetafileRenderingOptions > value)
 Setter for get_MetafileRenderingOptions. More...
 
void set_NumeralFormat (NumeralFormat value)
 Setter for get_NumeralFormat. More...
 
virtual void set_OptimizeOutput (bool value)
 Setter for get_OptimizeOutput. More...
 
void set_PageSavingCallback (SharedPtr< IPageSavingCallback > value)
 Setter for get_PageSavingCallback. More...
 
void set_PageSet (SharedPtr< PageSet > value)
 Setter for get_PageSet. More...
 
- Public Member Functions inherited from SaveOptions
bool get_AllowEmbeddingPostScriptFonts () const
 Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false. More...
 
SharedPtr< TimeZoneInfoget_CustomTimeZoneInfo () const
 
String get_DefaultTemplate () const
 Gets or sets path to default template (including filename). Default value for this property is empty string (Empty). More...
 
Dml3DEffectsRenderingMode get_Dml3DEffectsRenderingMode () const
 Gets a value determining how 3D effects are rendered. More...
 
virtual DmlEffectsRenderingMode get_DmlEffectsRenderingMode ()
 Gets or sets a value determining how DrawingML effects are rendered. More...
 
DmlRenderingMode get_DmlRenderingMode () const
 Gets or sets a value determining how DrawingML shapes are rendered. More...
 
bool get_MemoryOptimization () const
 Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false. More...
 
bool get_PrettyFormat () const
 When true, pretty formats output where applicable. Default value is false. More...
 
String get_TempFolder () const
 Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used. More...
 
bool get_UpdateCreatedTimeProperty () const
 Gets a value determining whether the CreatedTime property is updated before saving. Default value is false;. More...
 
bool get_UpdateFields () const
 Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true. More...
 
bool get_UpdateLastPrintedProperty () const
 Gets or sets a value determining whether the LastPrinted property is updated before saving. More...
 
bool get_UpdateLastSavedTimeProperty () const
 Gets or sets a value determining whether the LastSavedTime property is updated before saving. More...
 
bool get_UpdateSdtContent () const
 Gets or sets value determining whether content of StructuredDocumentTag is updated before saving. More...
 
bool get_UseAntiAliasing () const
 Gets or sets a value determining whether or not to use anti-aliasing for rendering. More...
 
bool get_UseHighQualityRendering () const
 Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. More...
 
void set_AllowEmbeddingPostScriptFonts (bool value)
 Setter for get_AllowEmbeddingPostScriptFonts. More...
 
void set_CustomTimeZoneInfo (SharedPtr< TimeZoneInfo > value)
 
void set_DefaultTemplate (String value)
 Setter for get_DefaultTemplate. More...
 
void set_Dml3DEffectsRenderingMode (Dml3DEffectsRenderingMode value)
 Sets a value determining how 3D effects are rendered. More...
 
virtual void set_DmlEffectsRenderingMode (DmlEffectsRenderingMode value)
 Setter for get_DmlEffectsRenderingMode. More...
 
void set_DmlRenderingMode (DmlRenderingMode value)
 Setter for get_DmlRenderingMode. More...
 
void set_MemoryOptimization (bool value)
 Setter for get_MemoryOptimization. More...
 
void set_PrettyFormat (bool value)
 Setter for get_PrettyFormat. More...
 
void set_TempFolder (String value)
 Setter for get_TempFolder. More...
 
void set_UpdateCreatedTimeProperty (bool value)
 Sets a value determining whether the CreatedTime property is updated before saving. Default value is false;. More...
 
void set_UpdateFields (bool value)
 Setter for get_UpdateFields. More...
 
void set_UpdateLastPrintedProperty (bool value)
 Setter for get_UpdateLastPrintedProperty. More...
 
void set_UpdateLastSavedTimeProperty (bool value)
 Setter for get_UpdateLastSavedTimeProperty. More...
 
void set_UpdateSdtContent (bool value)
 Setter for get_UpdateSdtContent. More...
 
void set_UseAntiAliasing (bool value)
 Setter for get_UseAntiAliasing. More...
 
void set_UseHighQualityRendering (bool value)
 Setter for get_UseHighQualityRendering. More...
 
- Public Member Functions inherited from Object
ASPOSECPP_SHARED_API Object ()
 
ASPOSECPP_SHARED_API Object (Object const &x)
 
virtual ASPOSECPP_SHARED_API ~Object ()
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 
ASPOSECPP_SHARED_API void Lock ()
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual ASPOSECPP_SHARED_API String ToString () const
 
ASPOSECPP_SHARED_API void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from FixedPageSaveOptions
static const TypeInfoType ()
 
- Static Public Member Functions inherited from SaveOptions
static SharedPtr< SaveOptionsCreateSaveOptions (SaveFormat saveFormat)
 Creates a save options object of a class suitable for the specified save format. More...
 
static SharedPtr< SaveOptionsCreateSaveOptions (String fileName)
 Creates a save options object of a class suitable for the file extension specified in the given file name. More...
 
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Additional Inherited Members

- Public Types inherited from Object
typedef SmartPtr< Objectptr
 

Constructor & Destructor Documentation

◆ ImageSaveOptions()

Aspose::Words::Saving::ImageSaveOptions::ImageSaveOptions ( Aspose::Words::SaveFormat  saveFormat)

Initializes a new instance of this class that can be used to save rendered images in the Tiff, Png, Bmp, Emf, Jpeg or Svg format. Png, Bmp, Jpeg or Svg format.

Parameters
saveFormatCan be Tiff, Png, Bmp, Emf, Jpeg or Svg. Png, Bmp, Jpeg or Svg.
Examples

Shows how to configure compression while saving a document as a JPEG.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Jpeg);
// Set the "JpegQuality" property to "10" to use stronger compression when rendering the document.
// This will reduce the file size of the document, but the image will display more prominent compression artifacts.
imageOptions->set_JpegQuality(10);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg", imageOptions);
ASSERT_GE(20000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg")->get_Length());
// Set the "JpegQuality" property to "100" to use weaker compression when rending the document.
// This will improve the quality of the image at the cost of an increased file size.
imageOptions->set_JpegQuality(100);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg", imageOptions);
ASSERT_LT(60000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg")->get_Length());

Member Function Documentation

◆ Clone()

System::SharedPtr<Aspose::Words::Saving::ImageSaveOptions> Aspose::Words::Saving::ImageSaveOptions::Clone ( )

Creates a deep clone of this object.

Examples

Shows how to select a bit-per-pixel rate with which to render a document to an image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
ASSERT_LT(20000, MakeObject<System::IO::FileInfo>(ImageDir + u"Logo.jpg")->get_Length());
// When we save the document as an image, we can pass a SaveOptions object to
// select a pixel format for the image that the saving operation will generate.
// Various bit per pixel rates will affect the quality and file size of the generated image.
auto imageSaveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
imageSaveOptions->set_PixelFormat(imagePixelFormat);
// We can clone ImageSaveOptions instances.
ASPOSE_ASSERT_NE(imageSaveOptions, imageSaveOptions->Clone());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PixelFormat.png", imageSaveOptions);

◆ get_HorizontalResolution()

float Aspose::Words::Saving::ImageSaveOptions::get_HorizontalResolution ( ) const

Gets or sets the horizontal resolution for the generated images, in dots per inch.

This property has effect only when saving to raster image formats and affects the output size in pixels.

The default value is 96.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

◆ get_ImageBrightness()

float Aspose::Words::Saving::ImageSaveOptions::get_ImageBrightness ( ) const

Gets or sets the brightness for the generated images.

This property has effect only when saving to raster image formats.

The default value is 0.5. The value must be in the range between 0 and 1.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

◆ get_ImageColorMode()

Aspose::Words::Saving::ImageColorMode Aspose::Words::Saving::ImageSaveOptions::get_ImageColorMode ( ) const

Gets or sets the color mode for the generated images.

This property has effect only when saving to raster image formats.

The default value is None.

Examples

Shows how to set a color mode when rendering documents.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
ASSERT_LT(20000, MakeObject<System::IO::FileInfo>(ImageDir + u"Logo.jpg")->get_Length());
// When we save the document as an image, we can pass a SaveOptions object to
// select a color mode for the image that the saving operation will generate.
// If we set the "ImageColorMode" property to "ImageColorMode.BlackAndWhite",
// the saving operation will apply grayscale color reduction while rendering the document.
// If we set the "ImageColorMode" property to "ImageColorMode.Grayscale",
// the saving operation will render the document into a monochrome image.
// If we set the "ImageColorMode" property to "None", the saving operation will apply the default method
// and preserve all the document's colors in the output image.
auto imageSaveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
imageSaveOptions->set_ImageColorMode(imageColorMode);
doc->Save(ArtifactsDir + u"ImageSaveOptions.ColorMode.png", imageSaveOptions);

◆ get_ImageContrast()

float Aspose::Words::Saving::ImageSaveOptions::get_ImageContrast ( ) const

Gets or sets the contrast for the generated images.

This property has effect only when saving to raster image formats.

The default value is 0.5. The value must be in the range between 0 and 1.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

◆ get_JpegQuality()

int32_t Aspose::Words::Saving::ImageSaveOptions::get_JpegQuality ( )

Gets or sets a value determining the quality of the generated JPEG images.

Has effect only when saving to JPEG.

Use this property to get or set the quality of generated images when saving in JPEG format. The value may vary from 0 to 100 where 0 means worst quality but maximum compression and 100 means best quality but minimum compression.

The default value is 95.

Examples

Shows how to configure compression while saving a document as a JPEG.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Jpeg);
// Set the "JpegQuality" property to "10" to use stronger compression when rendering the document.
// This will reduce the file size of the document, but the image will display more prominent compression artifacts.
imageOptions->set_JpegQuality(10);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg", imageOptions);
ASSERT_GE(20000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg")->get_Length());
// Set the "JpegQuality" property to "100" to use weaker compression when rending the document.
// This will improve the quality of the image at the cost of an increased file size.
imageOptions->set_JpegQuality(100);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg", imageOptions);
ASSERT_LT(60000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg")->get_Length());

◆ get_MetafileRenderingOptions()

System::SharedPtr<Aspose::Words::Saving::MetafileRenderingOptions> Aspose::Words::Saving::ImageSaveOptions::get_MetafileRenderingOptions ( )

Allows to specify how metafiles are treated in the rendered output.

When Vector is specified, Aspose.Words renders metafile to vector graphics using its own metafile rendering engine first and then renders vector graphics to the image.

When Bitmap is specified, Aspose.Words renders metafile directly to the image using the GDI+ metafile rendering engine.

GDI+ metafile rendering engine works faster, supports almost all metafile features but on low resolutions may produce inconsistent result when compared to the rest of vector graphics (especially for text) on the page. Aspose.Words metafile rendering engine will produce more consistent result even on low resolutions but works slower and may inaccurately render complex metafiles.

The default value for MetafileRenderingMode is Bitmap.

Examples

Shows how to set the rendering mode when saving documents with Windows Metafile images to other image formats.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(System::Drawing::Image::FromFile(ImageDir + u"Windows MetaFile.wmf"));
// When we save the document as an image, we can pass a SaveOptions object to
// determine how the saving operation will process Windows Metafiles in the document.
// If we set the "RenderingMode" property to "MetafileRenderingMode.Vector",
// or "MetafileRenderingMode.VectorWithFallback", we will render all metafiles as vector graphics.
// If we set the "RenderingMode" property to "MetafileRenderingMode.Bitmap", we will render all metafiles as bitmaps.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->get_MetafileRenderingOptions()->set_RenderingMode(metafileRenderingMode);
doc->Save(ArtifactsDir + u"ImageSaveOptions.WindowsMetaFile.png", options);
static ASPOSECPP_SHARED_API SharedPtr< Image > FromFile(const String &filename, bool use_embedded_color_management=false)

◆ get_PageSet()

System::SharedPtr<Aspose::Words::Saving::PageSet> Aspose::Words::Saving::ImageSaveOptions::get_PageSet ( )

Gets or sets the pages to render. Default is all the pages in the document.

This property has effect only when rendering document pages. This property is ignored when rendering shapes to images.

Examples

Shows how to render one page from a document to a JPEG image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Page 1.");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"Page 2.");
builder->InsertImage(ImageDir + u"Logo.jpg");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"Page 3.");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Jpeg);
// Set the "PageSet" to "1" to select the second page via
// the zero-based index to start rendering the document from.
options->set_PageSet(MakeObject<PageSet>(1));
// When we save the document to the JPEG format, Aspose.Words only renders one page.
// This image will contain one page starting from page two,
// which will just be the second page of the original document.
doc->Save(ArtifactsDir + u"ImageSaveOptions.OnePage.jpg", options);
@ PageBreak
Explicit page break.

Shows how to specify which page in a document to render as an image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world! This is page 1.");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"This is page 2.");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"This is page 3.");
ASSERT_EQ(3, doc->get_PageCount());
// When we save the document as an image, Aspose.Words only renders the first page by default.
// We can pass a SaveOptions object to specify a different page to render.
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Gif);
// Render every page of the document to a separate image file.
for (int i = 1; i <= doc->get_PageCount(); i++)
{
saveOptions->set_PageSet(MakeObject<PageSet>(1));
doc->Save(ArtifactsDir + String::Format(u"ImageSaveOptions.PageIndex.Page {0}.gif", i), saveOptions);
}
@ Gif
Renders a page of the document and saves it as a GIF file.

Shows how to render every page of a document to a separate TIFF image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Page 1.");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"Page 2.");
builder->InsertImage(ImageDir + u"Logo.jpg");
builder->InsertBreak(BreakType::PageBreak);
builder->Writeln(u"Page 3.");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
for (int i = 0; i < doc->get_PageCount(); i++)
{
// Set the "PageSet" property to the number of the first page from
// which to start rendering the document from.
options->set_PageSet(MakeObject<PageSet>(i));
doc->Save(ArtifactsDir + String::Format(u"ImageSaveOptions.PageByPage.{0}.tiff", i + 1), options);
}
@ Tiff
Renders a page or pages of the document and saves them into a single or multipage TIFF file.

Shows how to extract pages based on exact page ranges.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
auto pageSet = MakeObject<PageSet>(MakeArray<SharedPtr<PageRange>>(
{MakeObject<PageRange>(1, 1), MakeObject<PageRange>(2, 3), MakeObject<PageRange>(1, 3), MakeObject<PageRange>(2, 4), MakeObject<PageRange>(1, 1)}));
imageOptions->set_PageSet(pageSet);
doc->Save(ArtifactsDir + u"ImageSaveOptions.ExportVariousPageRanges.tiff", imageOptions);

◆ get_PaperColor()

System::Drawing::Color Aspose::Words::Saving::ImageSaveOptions::get_PaperColor ( )

Gets or sets the background (paper) color for the generated images. The default value is White.

When rendering pages of a document that specifies its own background color, then the document background color will override the color specified by this property.

Examples

Renders a page of a Word document into an image with transparent or colored background.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imgOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "PaperColor" property to a transparent color to apply a transparent
// background to the document while rendering it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_Transparent());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.Transparent.png", imgOptions);
// Set the "PaperColor" property to an opaque color to apply that color
// as the background of the document as we render it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_LightCoral());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.LightCoral.png", imgOptions);

◆ get_PixelFormat()

Aspose::Words::Saving::ImagePixelFormat Aspose::Words::Saving::ImageSaveOptions::get_PixelFormat ( ) const

Gets or sets the pixel format for the generated images.

This property has effect only when saving to raster image formats.

The default value is Format32BppArgb.

Pixel format of the output image may differ from the set value because of work of GDI+.

Examples

Shows how to select a bit-per-pixel rate with which to render a document to an image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
ASSERT_LT(20000, MakeObject<System::IO::FileInfo>(ImageDir + u"Logo.jpg")->get_Length());
// When we save the document as an image, we can pass a SaveOptions object to
// select a pixel format for the image that the saving operation will generate.
// Various bit per pixel rates will affect the quality and file size of the generated image.
auto imageSaveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
imageSaveOptions->set_PixelFormat(imagePixelFormat);
// We can clone ImageSaveOptions instances.
ASPOSE_ASSERT_NE(imageSaveOptions, imageSaveOptions->Clone());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PixelFormat.png", imageSaveOptions);

◆ get_SaveFormat()

Aspose::Words::SaveFormat Aspose::Words::Saving::ImageSaveOptions::get_SaveFormat ( )
overridevirtual

Specifies the format in which the rendered document pages or shapes will be saved if this save options object is used. Can be a raster Tiff, Png, Bmp, Jpeg or vector Emf, Svg.

On different platforms, the supported formats may be different. The number of other options depends on the selected format.

Also, it is possible to save to SVG both via ImageSaveOptions and via SvgSaveOptions.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

Implements Aspose::Words::Saving::SaveOptions.

◆ get_Scale()

float Aspose::Words::Saving::ImageSaveOptions::get_Scale ( ) const

Gets or sets the zoom factor for the generated images.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

Shows how to render an Office Math object into an image file in the local file system.

auto doc = MakeObject<Document>(MyDir + u"Office math.docx");
auto math = System::DynamicCast<OfficeMath>(doc->GetChild(NodeType::OfficeMath, 0, true));
// Create an "ImageSaveOptions" object to pass to the node renderer's "Save" method to modify
// how it renders the OfficeMath node into an image.
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "Scale" property to 5 to render the object to five times its original size.
saveOptions->set_Scale(5.0f);
math->GetMathRenderer()->Save(ArtifactsDir + u"Shape.RenderOfficeMath.png", saveOptions);
@ OfficeMath
An Office Math object. Can be equation, function, matrix or one of other mathematical objects....

◆ get_ThresholdForFloydSteinbergDithering()

uint8_t Aspose::Words::Saving::ImageSaveOptions::get_ThresholdForFloydSteinbergDithering ( ) const

Gets or sets the threshold that determines the value of the binarization error in the Floyd-Steinberg method. when ImageBinarizationMethod is ImageBinarizationMethod.FloydSteinbergDithering.

The default value is 128.

Examples

Shows how to set the TIFF binarization error threshold when using the Floyd-Steinberg method to render a TIFF image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as a TIFF, we can pass a SaveOptions object to
// adjust the dithering that Aspose.Words will apply when rendering this image.
// The default value of the "ThresholdForFloydSteinbergDithering" property is 128.
// Higher values tend to produce darker images.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
options->set_TiffCompression(TiffCompression::Ccitt3);
options->set_TiffBinarizationMethod(ImageBinarizationMethod::FloydSteinbergDithering);
options->set_ThresholdForFloydSteinbergDithering(240);
doc->Save(ArtifactsDir + u"ImageSaveOptions.FloydSteinbergDithering.tiff", options);
@ Ccitt3
Specifies the CCITT3 compression scheme.
@ FloydSteinbergDithering
Specifies dithering using Floyd-Steinberg error diffusion method.

◆ get_TiffBinarizationMethod()

Aspose::Words::Saving::ImageBinarizationMethod Aspose::Words::Saving::ImageSaveOptions::get_TiffBinarizationMethod ( ) const

Gets or sets method used while converting images to 1 bpp format when SaveFormat is SaveFormat.Tiff and TiffCompression is equal to TiffCompression.Ccitt3 or TiffCompression.Ccitt4.

The default value is ImageBinarizationMethod.Threshold.

Examples

Shows how to set the TIFF binarization error threshold when using the Floyd-Steinberg method to render a TIFF image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as a TIFF, we can pass a SaveOptions object to
// adjust the dithering that Aspose.Words will apply when rendering this image.
// The default value of the "ThresholdForFloydSteinbergDithering" property is 128.
// Higher values tend to produce darker images.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
options->set_TiffCompression(TiffCompression::Ccitt3);
options->set_TiffBinarizationMethod(ImageBinarizationMethod::FloydSteinbergDithering);
options->set_ThresholdForFloydSteinbergDithering(240);
doc->Save(ArtifactsDir + u"ImageSaveOptions.FloydSteinbergDithering.tiff", options);

◆ get_TiffCompression()

Aspose::Words::Saving::TiffCompression Aspose::Words::Saving::ImageSaveOptions::get_TiffCompression ( ) const

Gets or sets the type of compression to apply when saving generated images to the TIFF format.

Has effect only when saving to TIFF.

The default value is Lzw.

Examples

Shows how to select the compression scheme to apply to a document that we convert into a TIFF image.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Tiff);
// Set the "TiffCompression" property to "TiffCompression.None" to apply no compression while saving,
// which may result in a very large output file.
// Set the "TiffCompression" property to "TiffCompression.Rle" to apply RLE compression
// Set the "TiffCompression" property to "TiffCompression.Lzw" to apply LZW compression.
// Set the "TiffCompression" property to "TiffCompression.Ccitt3" to apply CCITT3 compression.
// Set the "TiffCompression" property to "TiffCompression.Ccitt4" to apply CCITT4 compression.
options->set_TiffCompression(tiffCompression);
doc->Save(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff", options);
switch (tiffCompression)
{
ASSERT_LT(3000000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff")->get_Length());
break;
ASSERT_LT(600000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff")->get_Length());
break;
ASSERT_LT(200000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff")->get_Length());
break;
ASSERT_GE(90000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff")->get_Length());
break;
ASSERT_GE(20000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.TiffImageCompression.tiff")->get_Length());
break;
}
@ Rle
Specifies the RLE compression scheme.
@ None
Specifies no compression.
@ Lzw
Specifies the LZW compression scheme. In Java emulated by Deflate (Zip) compression.
@ Ccitt4
Specifies the CCITT4 compression scheme.

◆ get_UseGdiEmfRenderer()

bool Aspose::Words::Saving::ImageSaveOptions::get_UseGdiEmfRenderer ( ) const

Gets or sets a value determining whether to use GDI+ or Aspose.Words metafile renderer when saving to EMF.

If set to true GDI+ metafile renderer is used. I.e. content is written to GDI+ graphics object and saved to metafile.

If set to false Aspose.Words metafile renderer is used. I.e. content is written directly to the metafile format with Aspose.Words.

Has effect only when saving to EMF.

GDI+ saving works only on .NET.

The default value is true.

Examples

Shows how to choose a renderer when converting a document to .emf.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an EMF image, we can pass a SaveOptions object to select a renderer for the image.
// If we set the "UseGdiEmfRenderer" flag to "true", Aspose.Words will use the GDI+ renderer.
// If we set the "UseGdiEmfRenderer" flag to "false", Aspose.Words will use its own metafile renderer.
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Emf);
saveOptions->set_UseGdiEmfRenderer(useGdiEmfRenderer);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Renderer.emf", saveOptions);
ASSERT_GE(30000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Renderer.emf")->get_Length());
@ Emf
Renders a page of the document and saves it as a vector EMF (Enhanced Meta File) file.

◆ get_VerticalResolution()

float Aspose::Words::Saving::ImageSaveOptions::get_VerticalResolution ( ) const

Gets or sets the vertical resolution for the generated images, in dots per inch.

This property has effect only when saving to raster image formats and affects the output size in pixels.

The default value is 96.

Examples

Shows how to edit the image while Aspose.Words converts a document to one.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_ParagraphFormat()->set_Style(doc->get_Styles()->idx_get(u"Heading 1"));
builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"Logo.jpg");
// When we save the document as an image, we can pass a SaveOptions object to
// edit the image while the saving operation renders it.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
options->set_ImageBrightness(0.3f);
options->set_ImageContrast(0.7f);
options->set_HorizontalResolution(72.f);
options->set_VerticalResolution(72.f);
options->set_Scale(96.f / 72.f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.EditImage.png", options);

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Saving::ImageSaveOptions::GetType ( ) const
overridevirtual

◆ Is()

virtual bool Aspose::Words::Saving::ImageSaveOptions::Is ( const System::TypeInfo target) const
overridevirtual

◆ set_HorizontalResolution()

void Aspose::Words::Saving::ImageSaveOptions::set_HorizontalResolution ( float  value)

◆ set_ImageBrightness()

void Aspose::Words::Saving::ImageSaveOptions::set_ImageBrightness ( float  value)

◆ set_ImageColorMode()

void Aspose::Words::Saving::ImageSaveOptions::set_ImageColorMode ( Aspose::Words::Saving::ImageColorMode  value)

◆ set_ImageContrast()

void Aspose::Words::Saving::ImageSaveOptions::set_ImageContrast ( float  value)

◆ set_JpegQuality()

void Aspose::Words::Saving::ImageSaveOptions::set_JpegQuality ( int32_t  value)

◆ set_PageSet()

void Aspose::Words::Saving::ImageSaveOptions::set_PageSet ( System::SharedPtr< Aspose::Words::Saving::PageSet value)

◆ set_PaperColor()

void Aspose::Words::Saving::ImageSaveOptions::set_PaperColor ( System::Drawing::Color  value)

◆ set_PixelFormat()

void Aspose::Words::Saving::ImageSaveOptions::set_PixelFormat ( Aspose::Words::Saving::ImagePixelFormat  value)

◆ set_Resolution()

void Aspose::Words::Saving::ImageSaveOptions::set_Resolution ( float  value)

Sets both horizontal and vertical resolution for the generated images, in dots per inch.

This property has effect only when saving to raster image formats.

Examples

Shows how to specify a resolution while rendering a document to PNG.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "Resolution" property to "72" to render the document in 72dpi.
options->set_Resolution(72.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png", options);
ASSERT_GE(120000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png")->get_Length());
// Set the "Resolution" property to "300" to render the document in 300dpi.
options->set_Resolution(300.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png", options);
ASSERT_LT(700000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png")->get_Length());

◆ set_SaveFormat()

void Aspose::Words::Saving::ImageSaveOptions::set_SaveFormat ( Aspose::Words::SaveFormat  value)
overridevirtual

◆ set_Scale()

void Aspose::Words::Saving::ImageSaveOptions::set_Scale ( float  value)

◆ set_ThresholdForFloydSteinbergDithering()

void Aspose::Words::Saving::ImageSaveOptions::set_ThresholdForFloydSteinbergDithering ( uint8_t  value)

◆ set_TiffBinarizationMethod()

void Aspose::Words::Saving::ImageSaveOptions::set_TiffBinarizationMethod ( Aspose::Words::Saving::ImageBinarizationMethod  value)

◆ set_TiffCompression()

void Aspose::Words::Saving::ImageSaveOptions::set_TiffCompression ( Aspose::Words::Saving::TiffCompression  value)

◆ set_UseGdiEmfRenderer()

void Aspose::Words::Saving::ImageSaveOptions::set_UseGdiEmfRenderer ( bool  value)

◆ set_VerticalResolution()

void Aspose::Words::Saving::ImageSaveOptions::set_VerticalResolution ( float  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Saving::ImageSaveOptions::Type ( )
static