Page 1 of 1

Passing filename as argument to program for MagickWriteImage

Posted: 2012-10-24T15:04:11-07:00
by Atirag
Hello, I'm trying to pass the filename of an image as argument to my program and use it with MagickReadImage and then to re-write the image with MagickWriteImage.

When I print the argument the path is fine

Code: Select all

  printf("argv 5 %s\n",argv[5]);
gives
argv 5 ../Imagenes/Clase 1/barleyrice001-inca-100dpi-00.png
Which is the correct path. When I do

Code: Select all

status=MagickReadImage(image_wand,argv[5]);
There's no error. Bu when I do

Code: Select all

status=MagickWriteImage(MagickGetImage(image_wand),argv[5]);
I get this
wand/magick-image.c:12753: MagickWriteImage: Assertion `wand != (MagickWand *) ((void *)0)' failed.
Any idea what could be happening? I used the same code but passing the name of the image not from program arguments and it gave me no problem.