How to create rounded rectangle in Aspose PSD for Python?
@sumukhavadhani ShapeLayer is one of newly added type for Aspose.PSD. So, this API has limitations.
I created a list of tasks, that should be implemented before this API will be convenient.
At this moment I can offer the copying of ShapeLayers from other PsdImage and then update them for your needs.
For example:
load_options = PsdLoadOptions()
load_options.load_effects_resource = True
load_options.allow_warp_repaint = True
source_file = "RoundedRect.psd"
with PsdImage.load(source_file, load_options) as img:
im = cast(PsdImage, img)
layer = cast(ShapeLayer, im.layers[1])
path = layer.path
with PsdImage(200, 200) as img:
# Copying round rect from other Image
new_layer = cast(ShapeLayer, layer.shallow_copy())
items = new_layer.path.get_items()
bezier_knots = items[0].get_items()
# Updating added shape layer
bezier_knots[1].points = [Point(1000, 5000), Point(10000, 2000), Point(50000, 30000)]
items[0].set_items(bezier_knots)
new_layer.path.set_items(items)
img.layers = [new_layer]
img.save("layers.psd")
@sumukhavadhani
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PSDNET-1962,PSDNET-1960,PSDNET-1963
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thank you. your solution works for me.
1 Like