Aspose.Imaging for Python via .NET 24.9 (macOS ARM64) delivers performance updates and fixes designed to enhance image processing workflows in your Python applications. Developers can now experience optimized memory consumption, precise SVG rendering, and enhanced gradient support.
Resolved TIFF Memory Issues
In the latest version of the Python imaging API, memory stream exceptions during TIFF file saving have been eliminated by fixing ObjectDisposedException
to ascertain convenient file-saving processes.
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*
Accurate SVG Rendering
Get richer SVGs owing to finer rendering for paths and gradients in SVG files using the latest release of the Python library and guarantee precise output on macOS ARM64.
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*
Optimized Memory Usage
Aspose.Imaging for Python via .NET 24.9 supports improved memory consumption by up to 30% in drawing tasks. This update increases the process efficiency of your Python image processing applications significantly.
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*
Better EMF to SVG Conversion
We have enhanced gradient support in EMF to SVG transformations for fine-tuned visual fidelity in your macOS M1-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.