assert failure in DestroyImageList (via montageImages)

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
User avatar
magick
Site Admin
Posts: 11040
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-03-15T08:19:03-07:00

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

User avatar
magick
Site Admin
Posts: 11040
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-04-13T15:43:05-07:00

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.

Post Reply