Skip to main content

Aspose.SVG for Python via .NET enables creating, editing, rendering, and converting SVGs to formats like PNG, PDF, and more, excelling in image vectorization. Perfect for developing SVG tools.

Project description

Process & Manipulate SVG via Python API

banner

Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support

Aspose.SVG for Python via .NET is a powerful on-premise class library designed to seamlessly work with SVG files in a wide range of operations without the need for additional SVG manipulation tools. It allows you to create, edit, optimize, and convert SVG. Python API allows you to manipulate documents and elements and provides robust navigation and inspection functionalities, such as XPath queries and CSS selectors. Developers can also vectorize images and texts, apply SVG transformations, filters, gradients, and patterns, and specify colors in different color formats. Aspose.SVG for Python via .NET supports both Windows and Unix platforms, making it perfectly suited for building applications such as SVG editors, converters, mergers, and image vectorizers catering to developers who require extensive SVG processing capabilities.

SVG API Features

The following are some popular features of Aspose.SVG for Python via .NET:

  • Cross-Platform Compatibility: Aspose.SVG can be used to develop applications across different operating systems including Windows, Linux, and macOS.
  • Versatile Document Manipulation: The Python API enables comprehensive manipulation of SVG files, supporting a wide range of SVG specifications. This includes everything from creating and modifying SVG content to converting SVG into popular formats like PDF, PNG, JPEG, GIF, WEBP, and more.
  • Direct Programmatic Access: The Python API provides developers with direct access to the SVG elements and their properties, facilitating precise control over SVG content.
  • High-Quality Rendering: The Python API offers high fidelity rendering of SVG files, ensuring that the output closely matches the original design, akin to native SVG rendering in browsers.
  • Extensive Documentation and Examples: Aspose.SVG for Python via .NET provides detailed documentation and guides to help developers understand and use the API effectively, along with code examples for common tasks.

Platform Independence

Aspose.SVG for Python via .NET is currently supported on Windows for developing applications where Python 3.6 or later is installed. You can build both 32-bit and 64-bit Python applications. Support for Linux and macOS X is planned for future versions.

Get Started

Ready to give Aspose.SVG for Python via .NET a try?

Simply run pip install aspose-svg-net from the Console to fetch the package. If you already have Aspose.SVG for Python via .NET and want to upgrade the version, please run pip install --upgrade aspose-svg-net to get the latest version.

You can run the following snippets in your environment to see how Aspose.SVG works, or check out the GitHub Repository or Aspose.SVG for Python via .NET Documentation for other common use cases.

Using Python to Convert SVG to PDF

Aspose.SVG for Python via .NET also allows you to convert SVG to PDF, XPS, PNG, JPEG, TIFF, WEBP, and other file formats. The following snippet demonstrates the conversion from SVG to PDF:

import aspose
from aspose.svg import *
from aspose.svg.converters import *
from aspose.svg.drawing.skiasharp import *
from aspose.svg.rendering import *
from aspose.svg.drawing import *

# Activate the Aspose.SVG.Drawing.SkiaSharp feature
Configuration.set_extension(SkiaModule())
options = PdfSaveOptions()
options.background_color = aspose.pydrawing.Color.transparent
options.page_setup.sizing = SizingType.FIT_CONTENT
options.horizontal_resolution = Resolution.from_dots_per_inch(96.0)
options.vertical_resolution = Resolution.from_dots_per_inch(96.0)
with SVGDocument("source.svg") as document:
	# Convert SVG to PDF
    Converter.convert_svg(document, options, "result.pdf")

Using Python to Vectorize Images

Aspose.SVG for Python via .NET also allows you can convert a raster image to vector graphic using default or custom configuration options. You will be able to apply custom settings to get the best result of the image-to-vector conversion and save the output SVG file to your computer. The following snippet demonstrates the image vectorization:

import os
from aspose.svg import *
from aspose.svg.converters import *
from aspose.svg.drawing import *
from aspose.svg.rendering.image import *
from aspose.svg.imagevectorization import *

# Setup directories
input_folder = "path/to/input_folder/"
output_folder = "path/to/output_folder/"
if not os.path.exists(output_folder):
    os.makedirs(output_folder)

# Configuration for vectorization
path_builder = BezierPathBuilder()
path_builder.trace_smoother = ImageTraceSmoother(2)  # Example severity level
path_builder.error_threshold = 30.0  # Example threshold
path_builder.max_iterations = 30  # Example max iterations

vectorizer = ImageVectorizer()
vectorizer.configuration.path_builder = path_builder
vectorizer.configuration.colors_limit = 25  # Example color limit
vectorizer.configuration.line_width = 1.0  # Example line width

# Vectorize the image
src_file = "example_image.png"  # Specify the test file
with vectorizer.vectorize(os.path.join(input_folder, src_file)) as document:
    output_file = os.path.join(output_folder, src_file + ".svg")
    document.save(output_file)

Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aspose_svg_net-25.3.0-py3-none-win_amd64.whl (57.7 MB view details)

Uploaded Python 3Windows x86-64

aspose_svg_net-25.3.0-py3-none-win32.whl (50.4 MB view details)

Uploaded Python 3Windows x86

aspose_svg_net-25.3.0-py3-none-manylinux1_x86_64.whl (79.8 MB view details)

Uploaded Python 3

File details

Details for the file aspose_svg_net-25.3.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for aspose_svg_net-25.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b995311b5beb045377be8c2c90e67285a8b62c7e393af600baa7f52370d3fb7e
MD5 8d4ba2dc47656fb65168ae6388c7af1a
BLAKE2b-256 cad92cd84d2743d6a25185c1cfd85e41fa93c79021966fbcb85396ecc3c84bcf

See more details on using hashes here.

File details

Details for the file aspose_svg_net-25.3.0-py3-none-win32.whl.

File metadata

  • Download URL: aspose_svg_net-25.3.0-py3-none-win32.whl
  • Upload date:
  • Size: 50.4 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.0

File hashes

Hashes for aspose_svg_net-25.3.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 a6e7e38f958721217582b6cb9e5ba2917e91a7ca3e7d0816e6d76784dfc5e346
MD5 4038dc4a83c3ec8cdf02a91f85e4f563
BLAKE2b-256 909a2e2741c1f371a53f64aa2e030cd142540ed212bf4772059ceb349fe16baf

See more details on using hashes here.

File details

Details for the file aspose_svg_net-25.3.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for aspose_svg_net-25.3.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1fdf081879e29fb6716467daf5e685b34555f971e52f08e750db0d56480f2b0e
MD5 cede52d811c0c1a00ec1df8b27fda12b
BLAKE2b-256 66f03e72639312bc29df74d3ff2125b7b6254bc8773513d013f76e04a8b03f5c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page