Streamline image rendering and memory consumption within your Python imaging applications using the latest Aspose.Imaging for Python via .NET 24.9 release on Windows AMD64. This release focuses on better SVG rendering, reducing memory usage, and fixing EMF to SVG conversion issues.
Handle Memory Stream ObjectDisposedException
Easily
The latest Python imaging API version includes empowered TIFF file-saving capabilities and supports seamless file-saving processes without memory-related exceptions.
Code sample:
from aspose.imaging import Image
from aspose.imaging.imageoptions import TiffOptions
from aspose.imaging.sources import StreamSource
from aspose.imaging.extensions import StreamExtensions as streams
from aspose.imaging.fileformats.tiff.enums import TiffExpectedFormat
def save_tiff(stream):
tiffOptions = TiffOptions(TiffExpectedFormat.TIFF_LZW_RGBA)
tiffOptions.source = StreamSource(stream)
with Image.create(tiffOptions, 1000, 1000) as image:
image.save()
# does not throw exception
print(stream.tell())
def tiff_test():
with streams.create_memory_stream() as ms:
save_tiff(ms)
gc.collect(0)
# does not throw exception
print(ms.tell())
tiff_test()
Source*
Optimized SVG Rendering
We have upgraded the path closure functionality during SVG rendering in the latest Python library release to ascertain accurate output on Windows AMD64.
Code sample:
### Example
The sample SVG is exported as an image with an open arc without crossed lines.
from aspose.imaging import Image
from aspose.imaging.imageoptions import SvgRasterizationOptions, PngOptions
inputFilePath = "svgHalfNotch2.svg"
outputFilePath = "svgHalfNotch2.svg.png"
with Image.load(inputFilePath) as image:
rasterizationOptions = SvgRasterizationOptions()
rasterizationOptions.page_width = image.width
rasterizationOptions.page_height = image.height
pngOptions = PngOptions()
pngOptions.vector_rasterization_options = rasterizationOptions
image.save(outputFilePath, pngOptions)
Source*
Reduced Memory Consumption
Enjoy memory usage reduction by up to 30% with Aspose.Imaging for Python via .NET 24.9 and increase process efficiency considerably.
Code sample:
from aspose.imaging import Image, LoadOptions
from aspose.imaging.imageoptions import PngOptions, JpegOptions, BmpOptions
load_options = LoadOptions()
load_options.buffer_size_hint = 200
with Image.load("1.emf", load_options) as image:
image.save("output.png", PngOptions())
with Image.load("1.emf", load_options) as image:
image.save("output.jpg", JpegOptions())
with Image.load("1.emf", load_options) as image:
image.save("output.bmp", BmpOptions())
Source*
Extended SVG Gradient Support
You can work with improved gradient handling in EMF to SVG conversions within your Win64-powered Python applications.
Code sample:
from aspose.imaging import Image
input_file = "input.emf";
with Image.load(input_file) as image:
image.save(input_file + ".svg")
Source*
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Imaging for Python via .NET 24.9 Release Notes.