Magick++ generated multilayered PSD gives an error in Photoshop

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Blake
Posts: 1
Joined: 2015-03-26T14:14:43-07:00
Authentication code: 6789

Magick++ generated multilayered PSD gives an error in Photoshop

Post by Blake »

Hi there,

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;
        
    } 

Post Reply