Page 1 of 1

Posted: 2006-03-15T08:19:03-07:00
by magick
Instead of futzing with your code, we'll just post code that works:

Code: Select all

#include <Magick++.h>
#include <string>
#include <iostream>
#include <list>
#include <vector>

using namespace std;

using namespace Magick;

int main( int /*argc*/, char **argv)
{

  InitializeMagick("");

  int failures=0;

  try {

    list<Image> imageList;
    readImages( &imageList, "1.jpg" );
    readImages( &imageList, "2.jpg" );
    readImages( &imageList, "3.jpg" );

    vector<Image> montage;
    MontageFramed montageOpts;

    // Default montage
    montageImages( &montage, imageList.begin(), imageList.end(), montageOpts );

    // Montage with options set
    montage.clear();
    montageOpts.borderColor( "green" );
    montageOpts.borderWidth( 1 );
    montageOpts.compose( OverCompositeOp );
    montageOpts.fileName( "Montage" );
    montageOpts.frameGeometry( "6x6+3+3" );
    montageOpts.geometry("50x50+2+2>");
    montageOpts.gravity( CenterGravity );
    montageOpts.penColor( "yellow" );
    montageOpts.shadow( true );
    montageOpts.texture( "granite:" );
    montageOpts.tile("3x1");
    montageImages( &montage, imageList.begin(), imageList.end(), montageOpts );
    writeImages(montage.begin(), montage.end(), "new.jpg");
  }
  catch( Exception &error_ )
    {
      cout << "Caught exception: " << error_.what() << endl;
      return 1;
    }
  catch( exception &error_ )
    {
      cout << "Caught exception: " << error_.what() << endl;
      return 1;
    }

  if ( failures )
    {
      cout << failures << " failures" << endl;
      return 1;
    }

  return 0;
}

Posted: 2006-04-13T15:43:05-07:00
by magick
ImageMagick uses the Freetype delegate library to annotate text on an image. If ImageMagick was not built with the Freetype library it instead uses Ghostscript to render text. Install either Freetype or Ghostscript or both and your program should work.