from aspose.psd import Image from aspose.psd.fileformats.png import PngColorType from aspose.psd.fileformats.psd import PsdImage from aspose.psd.fileformats.psd.layers import TextLayer from aspose.psd.imageloadoptions import PsdLoadOptions from aspose.psd.imageoptions import PngOptions from aspose.pycore import cast # Specify File Paths sourceFile = "AllTypesLayerPsd.psd" outputFile = "LoadImageExample.png" # Specify Load Options loadOptions = PsdLoadOptions() loadOptions.load_effects_resource = True loadOptions.allow_warp_repaint = True # Specify Export Options exportOptions = PngOptions() exportOptions.color_type = PngColorType.TRUECOLOR_WITH_ALPHA # Open File using Aspose.PSD for Python with Image.load(sourceFile, loadOptions) as image: # Types of Aspose.PSD can be casted psdImage = cast(PsdImage, image) textLayer = cast(TextLayer, psdImage.layers[5]) textLayer.update_text("Simple Text Edit") # Export PSD File To PNG psdImage.save(outputFile, exportOptions)