I have to read 3 tiff/psd files and write them to a single psd file with 3 layers. I've written the code below. It compiles well and writes a file to disk. However, when I open the output psd file, Photoshop returns an error, saying:
Could not complete your request because an unexpected end-of-file was encountered.
What did I do wrong? I work with Magick++ (ImageMagick 6.9.0-0 from Mac Ports, Xcode 6.2, Mac OS X 10.10, Photoshop CC 2014).
Code: Select all
Magick::InitializeMagick(NULL);
Magick::Image image1;
Magick::Image image2;
Magick::Image image3;
image1.read("/Users/blake/Desktop/layer1.tif");
image2.read("/Users/blake/Desktop/layer2.tif");
image3.read("/Users/blake/Desktop/layer3.tif");
std::list<Magick::Image> layers;
try {
// copy images as layers
layers.push_back (image1);
layers.push_back (image2);
layers.push_back (image3);
Magick::writeImages(layers.begin(), layers.end(), "/Users/blake/Desktop/all_layers.psd", true);
}
catch( Magick::Exception &error_ )
{
std::cout << "Caught exception: " << error_.what() << std::endl;
}