This release of Aspose.Imaging for Python via .NET 24.9 (Linux x64) is ideal for developers working with image conversions in their Python imaging applications.
TIFF Memory Fix
The Python imaging API now addresses memory stream exceptions while saving TIFF files by fixing ObjectDisposedException
to ensure hassle-free 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*
Improved SVG Rendering
Create better SVG outputs with refined rendering for paths and gradients in SVG files using the newest release of the Python library and ascertain precise output on Linux x64.
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*
Lower Memory Consumption
Aspose.Imaging for Python via .NET 24.9 provides reduced memory usage during complex drawing operations. This update enhances the process efficiency of your Python image processing applications 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*
Enhanced EMF to SVG Gradient Support
We have extended gradient handling for more accurate EMF to SVG conversions in this Python library version.
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.