Package: aspose-psd
PSD, PSB, AI Manipulation APIProduct Page|Documentation|Demos|Blog|API Reference|Search|Free Support|Temporary License|EULATry ourfree online Appsdemonstrating some of the most popular Aspose.PSD functionality.Aspose.PSD for Python via .NETis anUnique Python PSD Libraryoffering advanced PSD, PSD and AI files processing features. You could easily create, load, update, edit, convert, compress PSD and PSB images using this API. Aspose.PSD Supports most popular features for PSD and PSB files including updates of Text Layers, Smart Objects, Fill Layers, Shape Layers, Group Layers, Adjustment Layers.Aspose.PSDsupports Blendings Modes, Layer Effects, Warp Transformations, Smart Filters, Animation TimeLine, Working with Vector, Raster and Clipping Masks, Low-Level PSD file resource exploring and much more. Also, library supports drawing and work with graphic primitives for Regular Layers.Aspose.PSDis able to export and convert PSD, PSB, AI formats to PNG, TIFF, PDF, JPEG, GIF, BMP. IT supports popular combinations of Bit Depths and Color Modes. Besides the all described a many common tranformation like Layer Resize, Crop, Shift, Rotating are supported too. This is an ultimate PSD, PSB and AI Format Processing Library for any use-cases. It's crossplatform: Windows, MacOS, MacOS-ARM, Linux are supported.Aspose.PSD for Python via .NETis an ultimate, flexible, stable and powerful API to work with PSD, PSB and AI formats.Aspose.PSDis cross-platform library, it is Windows x32/x64, Linux x64, and MacOS x64/Arm64 compatible.Aspose.PSD for Python requires you to use python programming language. ForJavaand.NETlanguages, we recommend you to getAspose.PSD for JavaandAspose.PSD for .NET, respectively.Product FeaturesThe following are Aspose.PSD’s core features:Create PSD and PSB images from scratchOpen and Export of PSD, PSB and AI images to PDF, JPEG, PNG, TIFF, BMP, GIF, BMPAspose.PSD Team actively work on manipulation with AI filesUpdate PSD and PSB imagesAdding of JPEG, PNG, TIFF, BMP, GIF, BMP files as a layers for editingSupport of layers: Regular Layer, Text Layer, Smart Object, Group Layer, Adjustment Layer, Fill Layer, Shape LayerSupport of Blending Options, Layer Effects, Raster, Vector andd Clipping Masks, Warp Transformations, Smart FiltersDraw lines, circles, ellipses, texts, complex paths, and images using the classes GraphicsProcess images (including per-pixel modifications)Convert PSD and PSB Files  between different Color Modes and Bit DepthsSupported File FormatsFile formatLoadSaveAdd as a LayerPSDYesYesYesPSBYesYesYesAIYesWorking on itYesBMP-YesYesGIF-YesYesJPEG-YesYesJPEG2000-YesYesPNG-YesYesTIFF-YesYesPDF-YesWorking on itPlatform IndependenceAspose.PSD for Python can be used to develop applications for a wide range of operating systems, such as Windows (x32/x64), Linux (x64), and MacOS (x64/arm64) where Python 3.5 or later is installed.The base .NET platform is .NET Core 6.0Do not use System.Drawing.Common but the platform-independent Aspose.Drawing.Get StartedReady to give Aspose.PSD for Python a try?Simply runpip install aspose-psdfrom the console to fetch the package. If you already have Aspose.PSD for Python and want to upgrade the version, please runpip install --upgrade aspose-psdto get the latest version.You can run the following snippets in your environment to see how Aspose.PSD works, or check out theGitHub RepositoryorAspose.PSD for Python Documentationfor other common use cases.Open PSD File in Python and update textfromaspose.psdimportImagefromaspose.psd.fileformats.pngimportPngColorTypefromaspose.psd.fileformats.psdimportPsdImagefromaspose.psd.fileformats.psd.layersimportTextLayerfromaspose.psd.imageloadoptionsimportPsdLoadOptionsfromaspose.psd.imageoptionsimportPngOptionsfromaspose.pycoreimportcast# Specify File PathssourceFile="AllTypesLayerPsd.psd"outputFile="LoadImageExample.png"# Specify Load OptionsloadOptions=PsdLoadOptions()loadOptions.load_effects_resource=TrueloadOptions.allow_warp_repaint=True# Specify Export OptionsexportOptions=PngOptions()exportOptions.color_type=PngColorType.TRUECOLOR_WITH_ALPHA# Open File using Aspose.PSD for PythonwithImage.load(sourceFile,loadOptions)asimage:# Types of Aspose.PSD can be castedpsdImage=cast(PsdImage,image)textLayer=cast(TextLayer,psdImage.layers[5])textLayer.update_text("Simple Text Edit")# Export PSD File To PNGpsdImage.save(outputFile,exportOptions)Create a PSD File From Scratch. Create Regular Layer using Graphics API and Create Text Layer with Shadow Effectfromaspose.psdimportGraphics,Pen,Color,Rectanglefromaspose.psd.brushesimportLinearGradientBrushfromaspose.psd.fileformats.psdimportPsdImageoutputFile="CreateFileFromScratchExample.psd"# Create PSD Image with specified dimensionswithPsdImage(500,500)asimg:# Create Regular PSD Layer and update it with Graphic APIregularLayer=img.add_regular_layer()# Use popular Graphic API for Editinggraphics=Graphics(regularLayer)pen=Pen(Color.alice_blue)brush=LinearGradientBrush(Rectangle(250,250,150,100),Color.red,Color.aquamarine,45)graphics.draw_ellipse(pen,Rectangle(100,100,200,200))graphics.fill_ellipse(brush,Rectangle(250,250,150,100))# Create Text LayertextLayer=img.add_text_layer("Sample Text",Rectangle(200,200,100,100))# Adding Shadow to TextdropShadowEffect=textLayer.blending_options.add_drop_shadow()dropShadowEffect.distance=0dropShadowEffect.size=8dropShadowEffect.color=Color.blue# Save PSD Fileimg.save(outputFile)Add Image File as a Layer or Open Image File as a PSDfromioimportBytesIOfromaspose.psd.fileformats.psdimportPsdImagefromaspose.psd.fileformats.psd.layersimportLayerinputFile="inputFile.png"outputFile="AddFileAsLayer.psd"# Open file as Streamwithopen(inputFile,"rb",buffering=0)asfilestream:stream=BytesIO(filestream.read())stream.seek(0)# Create PSD Layer from Streamlayer=Layer(stream)# Create PSD Image with the specified sizepsdImage=PsdImage(layer.width,layer.height)# Add Layer to PSD ImagepsdImage.layers=[layer]# Get Pixels from Filepixels=layer.load_argb_32_pixels(layer.bounds)pixelsRange=range(len(pixels))# Fill the pixels data with some valuesforiinpixelsRange:ifi%5==0:pixels[i]=500000# Fast Save of Updated Image Datalayer.save_argb_32_pixels(layer.bounds,pixels)# Save PSD ImagepsdImage.save(outputFile)Set License Examplefromaspose.psdimportLicenselicense=License()licensePath="PathToLicenseFile"license.set_license(licensePath)Product Page|Documentation|Demos|Blog|API Reference|Search|Free Support|Temporary License|EULA