Hello again!

The following code should read and write an image. It indeed reads and
writes an image to my
hard-drive (jpg pics for example). The problem is that it crashes (couldn't
read from memory ...)
after that. If I remove the "DestroyImage(image);" line it works fine. Is
this a bug, or am I doing
something which is not necessary/allowed?

I'm using IM 6.4.0.

Thanks,

Wilbert

----------------------

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <magick/MagickCore.h>

int main(int argc,char **argv)
{
  ExceptionInfo
    *exception;

  Image
    *image, *images;

  ImageInfo
    *image_info;

  MagickCoreGenesis(argv[1], MagickTrue);
  exception = AcquireExceptionInfo();
  image_info = CloneImageInfo((ImageInfo *) NULL);
  (void) strcpy(image_info->filename,argv[1]);

  images = ReadImage(image_info, exception);
  image = GetImageFromList(images, 0);

  (void) strcpy(image->filename,argv[2]);

  WriteImage(image_info,image);

  DestroyImage(image);
  DestroyImageList(images);
  DestroyImageInfo(image_info);
  DestroyExceptionInfo(exception);
  MagickCoreTerminus();
  return(0);
}
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to