VectorRasterizationOptions Class

Summary: The vector rasterization options.
Please note that VectorRasterizationOptions will no longer derive from ImageOptionsBase
since Aspose.Imaging 24.12 version.

Module: aspose.imaging.imageoptions

Full Name: aspose.imaging.imageoptions.VectorRasterizationOptions

Inheritance: IHasXmpData, IHasMetadata, ImageOptionsBase

Constructors

NameDescription
VectorRasterizationOptions()Initializes a new instance of the VectorRasterizationOptions class

Properties

NameTypeAccessDescription
background_colorColorr/wGets or sets a background color.
border_xfloatr/wGets or sets the border X.
border_yfloatr/wGets or sets the border Y.
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
center_drawingboolr/wGets or sets a value indicating whether center drawing.
disposedboolrGets a value indicating whether this instance is disposed.
draw_colorColorr/wGets or sets a foreground color.
full_frameboolr/wGets or sets a value indicating whether [full frame].
keep_metadataboolr/wGets a value whether to keep original image metadata on export.
multi_page_optionsMultiPageOptionsr/wThe multipage options
page_heightfloatr/wGets or sets the page height.
If the value is 0, the source image aspect ratio will be preserved.
page_sizeSizeFr/wGets or sets the page size.
If one of SizeF dimensions is 0, the source image aspect ratio will be preserved.
page_widthfloatr/wGets or sets the page width.
If the value is 0, the source image aspect ratio will be preserved.
paletteIColorPaletter/wGets or sets the color palette.
positioningPositioningTypesr/wGets or sets the positioning.
resolution_settingsResolutionSettingr/wGets or sets the resolution settings.
smoothing_modeSmoothingModer/wGets or sets the smoothing mode.
sourceSourcer/wGets or sets the source to create image in.
text_rendering_hintTextRenderingHintr/wGets or sets the text rendering hint.
vector_rasterization_optionsVectorRasterizationOptionsr/wGets or sets the vector rasterization options.
xmp_dataXmpPacketWrapperr/wGets or sets the XMP metadata container.

Methods

NameDescription
clone()Creates a memberwise clone of this instance.
copy_to(vector_rasterization_options)Copies to.

Constructor: VectorRasterizationOptions()

 VectorRasterizationOptions() 

Initializes a new instance of the VectorRasterizationOptions class

Property: background_color

Gets or sets a background color.

See also:

Example # 1: This example shows how to load a WMF image from a file and convert it to SVG …

Property: page_size

Gets or sets the page size.
If one of SizeF dimensions is 0, the source image aspect ratio will be preserved.

See also:

Example # 1: This example shows how to load a WMF image from a file and convert it to SVG …

Property: positioning

Gets or sets the positioning.

See also:

Example # 1: The following example shows how to set a memory limit when loading a CMX imag…

Method: clone()

 clone() 

Creates a memberwise clone of this instance.

Returns

TypeDescription
ImageOptionsBaseA memberwise clone of this instance.

Method: copy_to(vector_rasterization_options)

 copy_to(vector_rasterization_options) 

Copies to.

Parameters:

ParameterTypeDescription
vector_rasterization_optionsVectorRasterizationOptionsThe vector rasterization options.

Examples

This example shows how to load a WMF image from a file and convert it to SVG using WmfRasterizationOptions.


from aspose.pycore import as_of, cast
from aspose.imaging import Image, Color, SizeF
from aspose.imaging.fileformats.wmf import WmfImage, WmfRenderMode
from aspose.imaging.imageoptions import SvgOptions, WmfRasterizationOptions

# Using Aspose.Imaging.Image.Load is a unified way to load all types of images including WMF.
with as_of(Image.load("test.wmf") as image:
	saveOptions = SvgOptions()
	# Text will be converted to shapes.
	saveOptions.text_as_shapes = True
	rasterizationOptions = WmfRasterizationOptions()
	# The background color of the drawing surface.
	rasterizationOptions.background_color = Color.white_smoke
	# The page size.
	rasterizationOptions.page_size = cast(SizeF, wmfImage.size)
	# If embedded emf exists, then render emf; otherwise render wmf.
	rasterizationOptions.render_mode = WmfRenderMode.AUTO
	saveOptions.vector_rasterization_options = rasterizationOptions
	wmfImage.save("test.output.svg", saveOptions)

The following example shows how to set a memory limit when loading a CMX image. The memory limit is the maximum allowed size (in megabytes) for all internal buffers.

from aspose.imaging import Image, TextRenderingHint, SmoothingMode, PositioningTypes, LoadOptions
from aspose.imaging.imageoptions import PngOptions, CmxRasterizationOptions
import os

directory = "c:\\aspose.imaging\\issues\\net\\3419\\"
	
# Setting a memory limit of 10 megabytes for a target loaded image.
load_options = LoadOptions()
load_options.buffer_size_hint = 10
with Image.load(os.path.join(directory, "example.cmx"), load_options) as image:
	png_options = PngOptions()
	cmx_spec = CmxRasterizationOptions()
	cmx_spec.text_renderingHint = TextRenderingHint.SINGLE_BIT_PER_PIXEL
	cmx_spec.smoothing_mode = SmoothingMode.ANTI_ALIAS
	cmx_spec.positioning = PositioningTypes.DEFINED_BY_DOCUMENT
	png_options.vector_rasterization_options = cmx_spec
	image.save(os.path.join(directory, "output.png"), png_options)