Rendering User-Defined Images using PSD API

Regency Hampers is a premium supplier of gift hampers with a large offering of different variants including classic fruit baskets, baby hampers, and fully-fitted picnic hampers. We have a bespoke system built on ASP.NET for both the front-end customer-facing website and back-end management interface. All system changes are developed in house which allows quick and easy adaptation to the changing market, and demands of the business

Problem

In order to broaden our product offerings, a decision was taken to allow users to personalize their purchases. Some products have wood cases or glassware that allow personalized wording, which can then be engraved, embroidered, thermal transferred etc. on to their chosen product. Whilst analyzing the problem, we found that the best solution would be to allow our designers to create the initial design in Photoshop, with all its intricacies, and then programmatically alter the text fields to the values entered by the customer stored in our database, thus allowing autonomous creation of personalized design files. This approach would give the designers ultimate control over the final product as all text/image placement would be easily editable for them via the original Photoshop design file.

Solution

The main challenge was in the most imperative part of the solution, altering the text field’s values. After careful research using the internet, Aspose.PSD for .NET seemed to be a solution. At first glance it looked suitable, allowing programmatic looping through all layers of a .PSD file, checking for their type (Only Text Layers were of interest, as images part of the design needed to stay as they were) and then checking their name for the relevant flag to say that they were editable fields. Upon identification of an editable field, the text value could be changed with ease. All these changes to the PSD file could then exported to the raster image type of our choosing (In this case BMP), with affecting the original design file allowing easy, repeat use.

Original Design File (Left) and Altered Design using Aspose.PSD (Right)

Other approaches were considered for this task, such as drawing elements using inbuilt libraries for .NET, but would create a large amount of work not only on the development side but also for our designers when it came to setting up new designs.

Experience

While looking at Aspose.PSD, we also looked at other products but after using the free trial it was clear that Aspose.PSD met our needs and was quick and easy to implement, having a working prototype ready within a day. This would have not been possible in the other approaches we considered, and the expediency of the project was greatly helped by the documentation provided (with examples on use). However, it was rarely needed as the library was easy and intuitive to use.

We ran into one issue while developing, with regards to changing the font of a text field, which resulted in rendering issues (The element would move location, render in a low resolution), we did, however, work around this by having multiple text elements and turning them on and off dependant on the font required. Hopefully, this issue will be resolved in the future.

Next Steps

At this time we have managed to achieve everything we set out to. Therefore, we currently do not have any plans to expand our offering using Aspose.PSD in the future but will be kept well in-mind for any future projects.

Summary

All in all, Aspose.PSD helped us achieve our goal of editing and rendering photoshop documents. While currently limited in its image manipulation capabilities (Transformations and warping are either limited or non-existent at this time), we do hope they will be added in the future to help further bolster our product offering.

Liam Dowen-Gould,
Regency Hampers Ltd

Download this success story in PDF format.