Skip to main content

Imaging Manipulation API

Product Page | Documentation | Demos | Blog | API Reference | Search | Free Support | Temporary License | EULA


Try our free online Apps demonstrating some of the most popular Aspose.Imaging functionality.

Aspose.Imaging for Python via .NET is Another Python Imaging Library offering advanced image processing features. You could easily create, load, manipulate, convert, compress images or photos using this API. Also Aspose.Imaging library supports drawing and work with graphic primitives. Image export and conversion (including uniform multi-page image processing) is the one of API core features along with image transformations (resize, crop, flip&rotate, binarization, grayscale, adjust, etc.), advanced image manipulation features (filtering, dithering, masking, deskewing) and memory optimization strategies.

Aspose.Imaging for Python via .NET is a flexible, stable and powerful API, capable of processing the most commonly used formats along with some special formats such as DjVu, DICOM, WebP & DNG. Moreover, it extends the native support for image formats & processing functions for .NET and .NET Core. Aspose.Imaging is cross-platform library, it is Windows x32/x64, Linux x64, and MacOS x64/Arm64 compatible.

Aspose.Imaging for Python requires you to use python programming language. For Java and .NET languages, we recommend you get Aspose.Imaging for Java and Aspose.Imaging for .NET, respectively.

Product Features

The following are Aspose.Imaging’s core features:

  • Create images (raster, vector)
  • Read images (raster, vector)
  • Write images (raster, vector)
  • Draw lines, circles, ellipses, texts, complex paths, and images using the classes Graphics, SvgGraphics2D, EmfRecorderGraphics2D, WmfRecorderGraphics2D
  • Process images (including per-pixel modifications)
  • Convert between different image formats as raster as vector
  • Support the large images with size more than 100000x100000 pixels
  • Memory and performance management strategies

Supported File Formats

File format Supported versions Load Save
APNG Animated Portable Network Graphics Yes Yes
AVIF AVIF (AV1 Image File Format) Version 1.0+ Yes No
BIG-TIFF BigTIFF is a TIFF variant file format which uses 64-bit offsets and supports much larger files (up to 18 exabytes in size). Yes Yes
BMP BMP Specification v5 Yes Yes
CDR Version X7, X6 (3-x5 not completely) Yes No
CMX Version 2.0, 32 bit precision (16 bit precision not completely) Yes No
DIB BMP Specification v5 Yes No
DICOM Version 3.0 Yes Yes
DJVU Version 3.0 Yes No
DNG Version 1.0.0.0 and later Yes No
DXF Dxf 6 and later No Yes
EMF Revision 11.0 Yes Yes
EMZ Compressed emf format Yes Yes
EPS Encapsulated Postscript file format  Yes No
GIF Version 89a Yes Yes
HTML5 canvas Html5 canvas element No Yes
ICO Version 1.0 and later Yes Yes
JPEG2000 ITU-T Rec. T.800 (08/2002 E) Yes Yes
JPEG CCITT Rec. T.81 (1992 E) Yes Yes
ODG Version 1.2 Yes No
OTG Version 1.2 Yes No
PDF Portable document format No Yes
PNG Version 1.0 and later Yes Yes
PSD Adobe Photoshop 2.0 and later No Yes
SVGZ Compressed svg file format Yes Yes
SVG Version 1.1 Yes Yes
TGA Truevision TGA (TARGA) Yes Yes
TIFF Version 6.0* Yes Yes
WEBP WebP is a raster graphics file format developed by Google intended as a replacement for JPEG, PNG, and GIF file formats. It supports both lossy and lossless compression,[8] as well as animation and alpha transparency.   Yes No
WMF Revision 13.0 Yes Yes
WMZ Compressed wmf format Yes Yes

Platform Independence

Aspose.Imaging for Python can be used to develop applications for a vast range of operating systems, such as Windows (x32/x64), Linux (x64), and MacOS (x64/arm64) where Python 3.5 or later (since 3.13) is installed.

The base .NET platform is .NET Core 6.0 Do not use System.Drawing.Common but the platform-independent Aspose.Drawing.

Get Started

Ready to give Aspose.Imaging for Python a try?

Simply run pip install aspose-imaging-python-net from the console to fetch the package. If you already have Aspose.Imaging for Python and want to upgrade the version, please run pip install --upgrade aspose-imaging-python-net to get the latest version.

You can run the following snippets in your environment to see how Aspose.Imaging works, or check out the GitHub Repository or Aspose.Imaging for Python Documentation for other common use cases.

Create a PNG image from scratch in Python

from aspose.imaging import Color, Graphics, Pen
from aspose.imaging.fileformats.png import PngImage

# create an empty PNG image
with PngImage(100, 100) as png:
	# create a canvas for drawing over the image
	g = Graphics(png)
	# start a queue of operations which will be processed together as a batch
	g.begin_update()
	# fill the background with blue color
	g.clear(Color.blue)
	# draw a line with light green pen with width == 2.0
	g.draw_line(Pen(Color.light_green, 2.0), 0, 10, 100, 90)
	# execute all drawing operations as one
	g.end_update()
	# save image in a file
	png.save("output.png")
	

Create and manipulate with PNG image

from aspose.imaging import Image, ResizeType, Graphics, Color, Pen, Rectangle
from aspose.imaging.fileformats.png import PngImage
from aspose.imaging.imageoptions import PngOptions
from aspose.imaging.sources import FileCreateSource
from aspose.pycore import as_of
import os

data_dir = "~/data-dir"
width = 500
height = 300
path = os.path.join(data_dir, "result.png")
with PngOptions() as options:
	options.source = FileCreateSource(path, False)
	with as_of(Image.create(options, width, height), PngImage) as image:
		graphic = Graphics(image)
		graphic.clear(Color.green)
		graphic.draw_line(Pen(Color.blue), 9, 9, 90, 90)
		new_width = 400
		image.resize_width_proportionally(new_width, ResizeType.LANCZOS_RESAMPLE)
		area = Rectangle(10, 10, 200, 200)
		image.crop(area)
		image.save() # save into the file set to options.source

Load, resize and save a raster image

from aspose.imaging import Image

with Image.load("any-picture.tiff") as image:
	image.resize(image.width // 2, image.height // 2)
	image.save("output.jpeg")

Load a raster image (PNG) and convert it into jpeg

from aspose.imaging import Image, FileFormat
from aspose.imaging.fileformats.png import PngImage
import aspose.pycore as pycore

with Image.load("any-picture.png") as image:
	print("format: ", FileFormat(image.file_format).name)
	# for accessing to a PngImage properties and methods need to cast it
	png_image = pycore.as_of(image, PngImage)
	print("xmp_data", png_image.xmp_data)
	
	image.save("output.jpeg")
    

Load jpeg and export it into the different formats

from aspose.imaging import Image
from aspose.imaging.fileformats.pdf import PdfDocumentInfo
from aspose.imaging.fileformats.tiff.enums import *
from aspose.imaging.imageoptions import *
import os

data_dir = "data-dir"
with Image.load(os.path.join(data_dir, "template.jpg")) as img:
	# convert to webp
	img.save(os.path.join(data_dir, "output.webp"), WebPOptions())
	# convert to psd
	img.save(os.path.join(data_dir, "output.psd "), PsdOptions())
	# convert to tiff
	img.save(os.path.join(data_dir, "output.tiff"), TiffOptions(TiffExpectedFormat.DEFAULT))
	# convert to pdf
	export_options = PdfOptions()
	export_options.pdf_document_info = PdfDocumentInfo()
	img.save(os.path.join(data_dir, "output.pdf"), export_options)

Crop image

from aspose.pycore import as_of
from aspose.imaging import Image, Rectangle, RasterImage
import os

data_dir = "data-dir"
with Image.load(os.path.join(data_dir, "template.jpg")) as img:
	# casting to the RasterImage class
	raster_image = as_of(img, RasterImage)
	# crop
	area = Rectangle(10, 10, img.width - 20, img.height - 20)
	raster_image.crop(area)
	image.save("cropped.jpg")

Merge images into one (collage)

from aspose.imaging import Image, Graphics, Color, RectangleF
from aspose.imaging.fileformats.png import PngColorType
from aspose.imaging.imageoptions import PngOptions
from aspose.imaging.sources import FileCreateSource
import os

data_dir = "data-dir"
images = []
# files for merging
files = ["template.png", "template.jpg"] # could be more file here
max_width = 0
max_height = 0
total_width = 0
total_height = 0
for file_name in files:
	image = Image.load(os.path.join(data_dir, file_name))
	total_width += image.width
	if image.width > max_width:
		max_width = image.width
	total_height += image.height
	if image.height > max_height:
		max_height = image.height
	images.append(image)


def merge_images(direction, out_file_name):
	target_width = 0
	target_height = 0
	if direction == 0:
		target_width = total_width
		target_height = max_height
	else:
		target_width = max_width
		target_height = total_height

	output_path = os.path.join(data_dir, out_file_name + ".png")
	with PngOptions() as png_options:
		png_options.color_type = PngColorType.TRUECOLOR_WITH_ALPHA
		
		with open(out_file_name, "wb") as stream:
			png_options.source = FileCreateSource(output_path, False)
			with Image.create(png_options, target_width, target_height) as image:
				image.background_color = Color.white
				graphics = Graphics(image)
				x = 0
				y = 0
				graphics.begin_update()
				for frame in images:
					print("x", x, "y", y)
					graphics.draw_image(frame, RectangleF(x, y, frame.width, frame.height))
					if direction == 0:
						x += frame.width
					if direction == 1:
						y += frame.height
						
				graphics.end_update()
				image.save(output_path)


# run 
merge_images(0, "collage_horizontal")
merge_images(1, "collage_vertical")

for image in images:
	# to dispose the image we call __exit__()
	with image as _:
		pass

Product Page | Documentation | Demos | Blog | API Reference | Search | Free Support | Temporary License | EULA

Metadata

Release files for aspose-imaging-python-net 26.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for aspose-imaging-python-net 26.11.0
File Actions
aspose_imaging_python_net-26.11.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for aspose_imaging_python_net-26.11.0-py3-none-win_amd64.whl
aspose_imaging_python_net-26.11.0-py3-none-win32.whl Python 3 none Windows x86-32 Details for aspose_imaging_python_net-26.11.0-py3-none-win32.whl
aspose_imaging_python_net-26.11.0-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details for aspose_imaging_python_net-26.11.0-py3-none-manylinux1_x86_64.whl
aspose_imaging_python_net-26.11.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for aspose_imaging_python_net-26.11.0-py3-none-macosx_11_0_arm64.whl
aspose_imaging_python_net-26.11.0-py3-none-macosx_10_14_x86_64.whl Python 3 none macOS 10.14+ x86-64 Details for aspose_imaging_python_net-26.11.0-py3-none-macosx_10_14_x86_64.whl

Total release size: 408.9 MB

Release files / aspose_imaging_python_net-26.11.0-py3-none-win_amd64.whl

Download URL aspose_imaging_python_net-26.11.0-py3-none-win_amd64.whl
Size 71.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
aff9ee4b0e9280048b80b2a0828b4da136c8b8f922327008f5a10c3a3eb0fe63
BLAKE2b-256 checksum
How to use checksums
ebdfab4280ae799b7000279ffabaa4c84354037c77b8d36f57e819395a418c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / aspose_imaging_python_net-26.11.0-py3-none-win32.whl

Download URL aspose_imaging_python_net-26.11.0-py3-none-win32.whl
Size 62.7 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
d477af6622d277a7cf5f5ceb74b4da1e3915503b85deefff2413bc6ac1c9e1a1
BLAKE2b-256 checksum
How to use checksums
35529a54fd2fcffd4f442a901176f2675456e0fc68fe6609879dab5fc8bc5579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / aspose_imaging_python_net-26.11.0-py3-none-manylinux1_x86_64.whl

Download URL aspose_imaging_python_net-26.11.0-py3-none-manylinux1_x86_64.whl
Size 107.7 MB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5d627e5482e048e62a552fded9ee72adcf26e8302614c4dfd0df9a73df5ee590
BLAKE2b-256 checksum
How to use checksums
7c2ce25743ce8960eab5b28add10b9a5be78e65ecfba6b65869c07f1e36d0256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / aspose_imaging_python_net-26.11.0-py3-none-macosx_11_0_arm64.whl

Download URL aspose_imaging_python_net-26.11.0-py3-none-macosx_11_0_arm64.whl
Size 73.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1c6927c427f66f1ccaea22a1fdc13be1562c653f6acbf4c2986226768b1c0e40
BLAKE2b-256 checksum
How to use checksums
81f6b3778727aac5092a115c10ac6cdf7f39653334e83e2a2b0a881f282f55d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / aspose_imaging_python_net-26.11.0-py3-none-macosx_10_14_x86_64.whl

Download URL aspose_imaging_python_net-26.11.0-py3-none-macosx_10_14_x86_64.whl
Size 93.6 MB
Tags Python 3 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
2f84e81aac5878d777e17277a66cffcd7e9a0bb864d664d6041305c38cc4f01f
BLAKE2b-256 checksum
How to use checksums
92ef788232f8358ba265935cc0e1626f581bc9283bd35440c31b23fb25173ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for aspose-imaging-python-net 26.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

26.11.0 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page