@dqpowered
Please check the following article https://docs.aspose.com/psd/net/creating-opening-and-saving-images/#load-image-as-layer-from-a-stream
Also, here is Java Version
public class Main {
public static void main(String[] args) {
openAsLayer("");
}
public static void openAsLayer (String dataDir) {
String outputFilePath = dataDir + "PsdResult.psd";
String[] filesList = new String[]{
"PsdExample.psd",
"BmpExample.bmp",
"GifExample.gif",
"Jpeg2000Example.jpf",
"JpegExample.jpg",
"PngExample.png",
"TiffExample.tif",
};
try (PsdImage image = new PsdImage(200, 200)) {
for (String s : filesList) {
String filePath = dataDir + s;
try (InputStream stream = new FileStream(filePath, FileMode.Open).toInputStream()) {
Layer layer = null;
try {
layer = new Layer(stream);
image.addLayer(layer);
} catch (Exception e) {
if (layer != null) {
layer.dispose();
}
throw e;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
image.save(outputFilePath);
}
}
}
Aspose.PSD can not open files as Png, Jpeg or any other formats, but it can easily open these types of images as layer. And then the PSD file can be saved.