Skip to content

Instantly share code, notes, and snippets.

View aspose-com-gists's full-sized avatar

Aspose.com Gists aspose-com-gists

View GitHub Profile
@aspose-com-gists
aspose-com-gists / insert-image-in-photoshop-layer.py
Created October 13, 2025 20:52
Insert Image in Photoshop Layer using Python
from io import BytesIO
import aspose.psd as psd
from aspose.psd.fileformats.psd import PsdImage
from aspose.psd.fileformats.psd.layers import Layer
inputFile = "sample.png"
outputFile = "AddFileAsLayer.psd"
# Open file as Stream.
with open(inputFile, "rb", buffering=0) as filestream:
stream = BytesIO(filestream.read())
@aspose-com-gists
aspose-com-gists / Aspose.HTML for Python via .NET – How-to Articles
Last active October 14, 2025 15:36
Code examples for common HTML user cases in Python
Aspose.HTML for Python via .NET – How-to Articles
@aspose-com-gists
aspose-com-gists / gpx-to-kml.py
Last active October 9, 2025 11:08
Convert GPX to KML in Python
import os
import aspose.gis as gis
from aspose.gis import VectorLayer, Drivers
# Define the working directory and license path.
data_dir = "files"
license_path = "license.lic"
# Apply Aspose.GIS license
license = gis.License()
license.set_license(license_path)
@aspose-com-gists
aspose-com-gists / shp-to-json.py
Last active October 7, 2025 21:29
Convert SHP to JSON in Python
import os
import aspose.gis as gis
from aspose.gis import VectorLayer, Drivers
from aspose.pycore import cast
# Define a class for converting Shapefiles (.shp) to JSON (.json)
class ShapefileToJsonConverter:
def __init__(self, data_dir, license_path):
# Store the directory containing data files
self.data_dir = data_dir
@aspose-com-gists
aspose-com-gists / geojson-to-topojson.py
Created October 6, 2025 21:05
Convert GeoJSON to TopoJSON in Python
import os
import aspose.gis as gis
from aspose.gis import VectorLayer, Drivers, ConversionOptions
from aspose.gis.formats.topojson import TopoJsonOptions
from aspose.pycore import cast
# Define path for the working directory and load the Aspose.GIS license.
dataDir = "files"
license = gis.License()
license.set_license("License.lic")
@aspose-com-gists
aspose-com-gists / dxf-to-svg.cs
Created October 2, 2025 21:07
Develop a DXF to SVG Converter in C#
// Define the path for the working directory.
string MyDir = "files";
string sourceFilePath = MyDir + "conic_pyramid.dxf";
// Load the source DXF file by calling the load method.
using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
{
// Create an object of CadRasterizationOptions
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
// Define page width & height.
rasterizationOptions.PageWidth = 1200;
@aspose-com-gists
aspose-com-gists / svg-to-png.py
Created October 1, 2025 12:14
Convert SVG to PNG in Python
import aspose.cad as cad
from aspose.cad.imageoptions import PngOptions
# A class to handle CAD image conversion using Aspose.CAD for Python via .NET
class CadImageConverter:
def __init__(self, input_path, output_path, license_path):
# Store input, output, and license file paths
self.input_path = input_path
self.output_path = output_path
self.license_path = license_path
@aspose-com-gists
aspose-com-gists / svg-to-pdf.py
Last active September 30, 2025 19:52
Convert SVG to PDF in Python
import aspose.cad as cad
from aspose.cad.imageoptions import PdfOptions
# Define the path for the working directory and apply Aspose.CAD license.
dataDir = "data"
license = cad.License()
license.set_license("latest.lic")
# Load the source SVG file by calling the load method.
image = cad.Image.load(dataDir+"paths.svg")
# Create an instance of the CadRasterizationOptions class.
cadRasterizationOptions = cad.imageoptions.CadRasterizationOptions()