I have some problem with the use of the libraries in Xcode.
I am not very good but I would like to try to use ImageMagick libraries with Xcode on Mac OSX lion (10.7). I have already installed ImageMagick (version : 6.7.4-0 Q16) thanks to MacPorts.
The compilation works but when I execute the program I have to kill it with some errors about bzip2 and I don't understand... why bzip2 ?
The code is very simple (only to understand how it works) :
Code: Select all
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <magick/api.h>
#include <magick/ImageMagick.h>
int main(int argc, const char * argv[])
{
ExceptionInfo *exception;
Image *image, *scaled_image;
ImageInfo *image_info;
/* Initialization of ImageMagick and useful structures */
MagickCoreGenesis(*argv,MagickTrue);
exception=AcquireExceptionInfo();
image_info=CloneImageInfo((ImageInfo *)NULL);
/* Reading an image */
strcpy(image_info->filename,"image.bmp");
image=ReadImage(image_info,exception);
/* Reduces the size of an image */
scaled_image=ResizeImage(image,320/4,240/4,LanczosFilter,1.0,exception);
if (scaled_image != (Image*) NULL)
{
DestroyImage(image);
image=scaled_image;
}
/* Saving the image in JPEG format and deallocation */
strcpy(image->filename, "image.jpg");
WriteImage(image_info,image);
DestroyImage(image);
/* Closing Imagemagick */
MagickCoreTerminus();
return(0);
}
Code: Select all
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys001
sharedlibrary apply-load-rules all
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/blocksort.o" - no debug information available for "blocksort.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/huffman.o" - no debug information available for "huffman.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/crctable.o" - no debug information available for "crctable.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/randtable.o" - no debug information available for "randtable.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/compress.o" - no debug information available for "compress.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/decompress.o" - no debug information available for "decompress.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_bzip2/bzip2/work/bzip2-1.0.6/bzlib.o" - no debug information available for "bzlib.c".
[Switching to process 59260 thread 0x0]
Assertion failed: (image != (Image *) NULL), function ResizeImage, file magick/resize.c, line 2563.
kill
Current language: auto; currently minimal
quit
Program ended with exit code: 0