new ImageSaveOptions(saveFormat)

Initializes a new instance of this class that can be used to save rendered images in the SaveFileFormat, SaveFileFormat, SaveFileFormat, SaveFileFormat or SaveFileFormat format.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("VisioSaveOptions.vsdx");
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.JPEG);
// specify the quality level to use during compositing.
options.setCompositingQuality(aspose.diagram.CompositingQuality.HIGH_QUALITY);
// sets the brightness for the 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.
options.setImageBrightness(1.0);
// value or the font is not installed locally, they may appear as a
// block,
// set the DefaultFont such as MingLiu or MS Gothic to show these
// characters.
options.setDefaultFont("MS Gothic");
// sets the number of pages to render in image.
options.setPageCount(2);
// sets the 0-based index of the first page to render. Default is 0.
options.setPageIndex(0);
// set page size
pgSize = new aspose.diagram.PageSize(aspose.diagram.PaperSizeFormat.A_1);
options.setPageSize(pgSize);
// discard saving background pages of the Visio diagram
options.setSaveForegroundPagesOnly(true);
// sets the color mode for the generated images.
options.setImageColorMode(aspose.diagram.ImageColorMode.BLACK_AND_WHITE);
// 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.
options.setImageContrast(1.0);
// specify the algorithm that is used when images are scaled or rotated.
// this property has effect only when saving to raster image formats.
options.setInterpolationMode(aspose.diagram.InterpolationMode.NEAREST_NEIGHBOR);
// 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.
options.setJpegQuality(100);
// set a value specifying how pixels are offset during rendering.
options.setPixelOffsetMode(aspose.diagram.PixelOffsetMode.HIGH_SPEED);
// sets the resolution for the generated images, in dots per inch. The
// default value is 96.
options.setResolution(2.0);
// sets the zoom factor for the generated images.
// the default value is 1.0. The value must be greater than 0.
options.setScale(1.0);
// specify whether smoothing (antialiasing) is applied to lines
// and curves and the edges of filled areas.
options.setSmoothingMode(aspose.diagram.SmoothingMode.HIGH_QUALITY);
// sets the type of compression to apply when saving generated images to
// the TIFF format.
options.setTiffCompression(aspose.diagram.TiffCompression.CCITT_3);
// save in any supported file format
diagram.save("out-UseImageSaveOptions.jpeg", options);

Parameter

Name Type Optional Description

saveFormat

 

 

SaveFileFormat

Methods

getArea()

Gets or sets the area of the shapes will be saved . This property has effect only when saving to raster image formats.

getCompositingQuality()

Specifies the quality level to use during compositing. The value of the property is CompositingQuality integer constant. This property has effect only when saving to raster image formats. The default value is CompositingQuality.

getContentZoom()

This parameter is similar with scale, but not effect the generated image size. The default value is 1.0. The value must be greater than 0.

getDefaultFont()

When characters in the diagram are unicode and not be set with correct font value or the font is not installed locally, they may appear as block in pdf, image or XPS. Set the DefaultFont such as MingLiu or MS Gothic to show these characters.

getEmfRenderSetting()

Setting for rendering Emf metafile. The value of the property is EmfRenderSetting integer constant. EMF metafiles identified as "EMF+ Dual" can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When #Error Cref: !:EmfRenderSetting.EmfPlusPrefer is set, then EMF+ records will be parsed , otherwise only EMF records will be parsed. Default value is #Error Cref: !:EmfRenderSetting.EmfOnly.

getEnlargePage()

Specifies whether enlarge page . If true - enlarge page. If false - not enlarge page. The default value is true.

getExportGuideShapes()

Defines whether need exporting the guide shapes or not. Default value is true.

getExportHiddenPage()

Defines whether need exporting the hidden page or not. Default value is true.

getImageBrightness()

Gets or sets the brightness for the 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.

getImageColorMode()

Gets or sets the color mode for the generated images. The value of the property is ImageColorMode integer constant. This property has effect only when saving to raster image formats. The default value is ImageColorMode.

getImageContrast()

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.

getInterpolationMode()

Specifies the algorithm that is used when images are scaled or rotated. The value of the property is InterpolationMode integer constant. This property has effect only when saving to raster image formats. The default value is InterpolationMode.

getJpegQuality()

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.

getPageCount()

Gets or sets the number of pages to render when saving to a multipage TIFF file. Default is MaxValue which means all pages of the diagram will be rendered.

getPageIndex()

Gets or sets the 0-based index of the first page to render. Default is 0.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("ExportPageToImage.vsd");
// Save diagram as PNG
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.PNG);
// Save one page only, by page index
options.setPageIndex(0);
// Save resultant Image file
diagram.save("out-ExportPageToImage.png", options);

getPageSize()

Gets or sets the page size for the generated images. Can be PageSize or null. The default value is null. If PageSize is null then page size for generated image is obtained from source diagram.

getPixelOffsetMode()

Gets or set a value specifying how pixels are offset during rendering. The value of the property is PixelOffsetMode integer constant. This property has effect only when saving to raster image formats. The default value is PixelOffsetMode.

getResolution()

Gets or sets the resolution for the generated images, in dots per inch. This property has effect only when saving to raster image formats. The default value is 96.

getSameAsPdfConversionArea()

Specifies whether saving area same as pdf . If true - rendered area same as pdf. If false - rendered area default. The default value is false.

getSaveForegroundPagesOnly()

Specifies whether all pages will be saved in image or only foreground. If true - rendered only foreground pages(with background if present). If false - rendered foreground pages(with background if present) after that empty background pages. Can return true only when PageCount > 1. The default value is false.

getSaveFormat()

Specifies the format in which the rendered diagram pages will be saved if this save options object is used. Can be SaveFileFormat, SaveFileFormat, SaveFileFormat, SaveFileFormat or SaveFileFormat. The value of the property is SaveFileFormat integer constant.

getScale()

Gets or sets the zoom factor for the generated images. The default value is 1.0. The value must be greater than 0.

getShapes()

Gets or sets shapes to render. Default count is 0.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("LoadSaveConvert.vsdx");
// create an instance SVG save options class
options = new aspose.diagram.SVGSaveOptions();
shapes = options.getShapes();
// get shapes by page index and shape ID, and then add in the shape collection object
shapes.add(diagram.getPages().get(0).getShapes().getShape(1));
shapes.add(diagram.getPages().get(0).getShapes().getShape(2));
// save Visio drawing
diagram.save("out-SelectiveShapes_out.svg", options);

getSmoothingMode()

Specifies whether smoothing (antialiasing) is applied to lines and curves and the edges of filled areas. The value of the property is SmoothingMode integer constant. This property has effect only when saving to raster image formats. The default value is SmoothingMode.

getTiffCompression()

Gets or sets the type of compression to apply when saving generated images to the TIFF format. The value of the property is TiffCompression integer constant. Has effect only when saving to TIFF. The default value is TiffCompression.

getWarningCallback()

Gets or sets warning callback.

isExportComments()

Defines whether need exporting the comments or not. Default value is false.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("Pages.vsdx");
// get a particular page
page = diagram.getPages().getPage("Flow 2");
// set Visio page visiblity
page.getPageSheet().getPageProps().getUIVisibility().setValue(aspose.diagram.BOOL.TRUE);
// initialize Image save options
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.setExportHiddenPage(false);
// set export option of comments
options.setExportComments(false);
diagram.save("out-ExportOfHiddenVisioPagesToImage.jpeg", options);

setCompositingQuality()

Specifies the quality level to use during compositing. The value of the property is CompositingQuality integer constant. This property has effect only when saving to raster image formats. The default value is CompositingQuality.

setContentZoom()

This parameter is similar with scale, but not effect the generated image size. The default value is 1.0. The value must be greater than 0.

setDefaultFont()

When characters in the diagram are unicode and not be set with correct font value or the font is not installed locally, they may appear as block in pdf, image or XPS. Set the DefaultFont such as MingLiu or MS Gothic to show these characters.

setEmfRenderSetting()

Setting for rendering Emf metafile. The value of the property is EmfRenderSetting integer constant. EMF metafiles identified as "EMF+ Dual" can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When #Error Cref: !:EmfRenderSetting.EmfPlusPrefer is set, then EMF+ records will be parsed , otherwise only EMF records will be parsed. Default value is #Error Cref: !:EmfRenderSetting.EmfOnly.

setEnlargePage()

Specifies whether enlarge page . If true - enlarge page. If false - not enlarge page. The default value is true.

setExportComments()

Defines whether need exporting the comments or not. Default value is false.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("Pages.vsdx");
// get a particular page
page = diagram.getPages().getPage("Flow 2");
// set Visio page visiblity
page.getPageSheet().getPageProps().getUIVisibility().setValue(aspose.diagram.BOOL.TRUE);
// initialize Image save options
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.setExportHiddenPage(false);
// set export option of comments
options.setExportComments(false);
diagram.save("out-ExportOfHiddenVisioPagesToImage.jpeg", options);

setExportGuideShapes()

Defines whether need exporting the guide shapes or not. Default value is true.

setExportHiddenPage()

Defines whether need exporting the hidden page or not. Default value is true.

setImageBrightness()

Gets or sets the brightness for the 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.

setImageColorMode()

Gets or sets the color mode for the generated images. The value of the property is ImageColorMode integer constant. This property has effect only when saving to raster image formats. The default value is ImageColorMode.

setImageContrast()

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.

setInterpolationMode()

Specifies the algorithm that is used when images are scaled or rotated. The value of the property is InterpolationMode integer constant. This property has effect only when saving to raster image formats. The default value is InterpolationMode.

setJpegQuality()

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.

setPageCount()

Gets or sets the number of pages to render when saving to a multipage TIFF file. Default is MaxValue which means all pages of the diagram will be rendered.

setPageIndex()

Gets or sets the 0-based index of the first page to render. Default is 0.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("ExportPageToImage.vsd");
// Save diagram as PNG
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.PNG);
// Save one page only, by page index
options.setPageIndex(0);
// Save resultant Image file
diagram.save("out-ExportPageToImage.png", options);

setPageSize()

Gets or sets the page size for the generated images. Can be PageSize or null. The default value is null. If PageSize is null then page size for generated image is obtained from source diagram.

setPixelOffsetMode()

Gets or set a value specifying how pixels are offset during rendering. The value of the property is PixelOffsetMode integer constant. This property has effect only when saving to raster image formats. The default value is PixelOffsetMode.

setResolution()

Gets or sets the resolution for the generated images, in dots per inch. This property has effect only when saving to raster image formats. The default value is 96.

setSameAsPdfConversionArea()

Specifies whether saving area same as pdf . If true - rendered area same as pdf. If false - rendered area default. The default value is false.

setSaveForegroundPagesOnly()

Specifies whether all pages will be saved in image or only foreground. If true - rendered only foreground pages(with background if present). If false - rendered foreground pages(with background if present) after that empty background pages. Can return true only when PageCount > 1. The default value is false.

setSaveFormat()

Specifies the format in which the rendered diagram pages will be saved if this save options object is used. Can be SaveFileFormat, SaveFileFormat, SaveFileFormat, SaveFileFormat or SaveFileFormat. The value of the property is SaveFileFormat integer constant.

setScale()

Gets or sets the zoom factor for the generated images. The default value is 1.0. The value must be greater than 0.

setShapes()

Gets or sets shapes to render. Default count is 0.

Example

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
diagram = new aspose.diagram.Diagram("LoadSaveConvert.vsdx");
// create an instance SVG save options class
options = new aspose.diagram.SVGSaveOptions();
shapes = options.getShapes();
// get shapes by page index and shape ID, and then add in the shape collection object
shapes.add(diagram.getPages().get(0).getShapes().getShape(1));
shapes.add(diagram.getPages().get(0).getShapes().getShape(2));
// save Visio drawing
diagram.save("out-SelectiveShapes_out.svg", options);

setSmoothingMode()

Specifies whether smoothing (antialiasing) is applied to lines and curves and the edges of filled areas. The value of the property is SmoothingMode integer constant. This property has effect only when saving to raster image formats. The default value is SmoothingMode.

setTiffCompression()

Gets or sets the type of compression to apply when saving generated images to the TIFF format. The value of the property is TiffCompression integer constant. Has effect only when saving to TIFF. The default value is TiffCompression.

setWarningCallback()

Gets or sets warning callback.