Browse our Products

Aspose.Imaging for Python via .NET 25.9 - Release notes

Competitive features:

  • Auto adjustment of image brightness
  • Support of digital signature
  • Support inheritance from Aspose.Imaging interfaces (such a IPartialArgb32PixelLoader, etc.)
KeySummaryCategory
IMAGINGPYTHONNET-421Optimize memory and cpu usage during PNG savingEnhancement
IMAGINGPYTHONNET-420Text block is missing when converting EMF to SVGEnhancement
IMAGINGPYTHONNET-419Infinite loop while decoding jpeg2000Enhancement
IMAGINGPYTHONNET-418Aspose.Imaging 22.12 Saved images are not supported for previewEnhancement
IMAGINGPYTHONNET-416Auto adjustment of image brightnessFeature
IMAGINGPYTHONNET-414Support of digital signatureFeature

Public API changes:

Usage Examples:

IMAGINGPYTHONNET-421 Optimize memory and cpu usage during PNG saving

from aspose.imaging import Image
from aspose.imaging.imageoptions import PngOptions
from aspose.imaging.fileformats.png import PngFilterType

inputPath = "input.png"

pngFilterTypes = (it for it in PngFilterType)

with Image.load(inputPath) as image:
	for filter in pngFilterTypes:
		options = PngOptions()
		options.filter_type = filter
		image.save(inputPath + "-" + filter.name + ".png", options)

IMAGINGPYTHONNET-420 Text block is missing when converting EMF to SVG

from aspose.imaging import Image

inputPath = "MissingTextOnBottomRightCorner.emf"
outputPath = inputPath + ".svg"
with Image.load(inputPath) as image:
    image.save(outputPath)

IMAGINGPYTHONNET-419 Infinite loop while decoding jpeg2000

from aspose.imaging import Image

inputPath = "input.jpx"
with Image.load(inputPath) as image:
    image.save(inputPath + ".jpg")

IMAGINGPYTHONNET-418 Aspose.Imaging 22.12 Saved images are not supported for preview

import io
import base64

from aspose.pycore import as_of
from aspose.imaging import Image, RasterImage
from aspose.imaging.imageoptions import PngOptions

base64Image = ""
with as_of(Image.load(inputFileName), RasterImage) as image:
	saveOptions = PngOptions()
	with io.BytesIO() as result:
		image.save(result, saveOptions)
		result.seek(0)
		pageBytes = result.read()
		base64Image = base64.b64encode(pageBytes)
		
print(base64Image)

IMAGINGPYTHONNET-416 Auto adjustment of image brightness

### Example
# Here is an example of using fully automated document readability enhancement filters:
from aspose.pycore import as_of
from aspose.imaging import Image, RasterImage


with as_of(Image.load(inputFileName), RasterImage) as image:
    image.normalize_histogram()
    image.auto_brightness_contrast()
    image.save(outputFileName + " normalized auto brightness contrast.jpg")

IMAGINGPYTHONNET-414 Support of digital signature

# Signing limitations:
#  - The LSB steganography algorithm requires the image to be at least 8 pixels in width and height, with a minimum of 16,384 total pixels.
#  - Password must be at least 4 characters long.

from aspose.pycore import as_of
from aspose.imaging import Image, RasterImage
from aspose.imaging.imageoptions import PngOptions


password = "1234"
filePath = r"c:\sunflower.jpg"

#################################### Example 1 ###############################
#   Faster checking method with partial data extraction.                     #
#   Set detectionThreasholdPercentage value to 75% (default value).          #
##############################################################################

with as_of(Image.load(filePath), RasterImage) as image:
    image.embed_digital_signature(password)

    isSigning = image.is_digital_signed(password, 75)
    print(f"Check signing result of file is: {isSigning}")


#################################### Example 2 ###############################
# Faster checking method with set detectionPercentageThreashold parameter.   #
# Also use partial data extraction method.                                   #
##############################################################################

detectionThreshold = 90 # range [0-100]

with as_of(Image.load(filePath), RasterImage) as image:
    image.embed_digital_signature(password)

    isSigning = image.is_digital_signed(password, detectionThreshold)
    print(f"Check signing result of file is: {isSigning}. Threshold is {detectionThreshold}")


#################################### Example 3 ###############################
# Performs full data extraction to maximize accuracy signature detection.    #
# Useful for cases with minor image modifications.                           #
##############################################################################

outputFilePath = r"c:\sunflower_signed_pass_1234.jpg"

with as_of(Image.load(filePath), RasterImage) as image:
    image.embed_digital_signature(password)
    image.save(outputFilePath, PngOptions())

with as_of(Image.load(outputFilePath), RasterImage) as image:
    signPercentage = image.analyze_percentage_digital_signature(password)
    print(f"Image signing probability percentage is: {signPercentage}")