If you’ve got or are working on any sort of app for image editing or drawing and multiple layers chances are you’re going to want to support the PSD image format used by Photoshop.
Here’s a library called PSDWriter from Ben Gotow that makes adding support for the PSD format dead simple. With this library you simply need to specify the images for each layer, opacity level, location offset, the layer names and generate the PSD.
There is an example included that takes two PNG images and turns them into a .PSD file.
You can find PSDWriter on Github here.
If you run the included iOS demo you may need to change the save directory of the PSD file to someplace like your documents directory.