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?".
Iam trying to read paths of images from a text file and load them into wands...im getting a status problem...can anyone please help me with it and i want to write all images with a different file name ..im trying something like this...
int main(int argc,char **argv)
{
MagickWand *magick_wand;
FILE *fp;
fp = fopen("./filenames.txt", "r");
char str[200];
if (argc != 4)
{
(void) fprintf(stdout,"Usage: %s image \n",argv[0]);
exit(0);
}
/*
Read an image.
*/
MagickWandGenesis(); // to initialize the magick-wand Environment
magick_wand=NewMagickWand(); // To create the wand to store image
printf("Loading Image....");
while(fgets(str,sizeof(str),fp) != NULL)
{
status=MagickReadImage(magick_wand,str); // Function to read image into wand
if (status == MagickFalse)
{
printf ("status problem");
}
v.sbimg_wdt=v.sbimg_hgt=atoi(argv[2]);
v.treshold=atoi(argv[3]);
subimages_pxls(magick_wand,v,argv);
magick_wand=DestroyMagickWand(magick_wand); // To Destroy the image in the wand
MagickWandTerminus();// To terminate the magick-wand Environment
}
return(0);
}
To write the image...m is a loop variable...it is an integer..
anthony wrote:What is the problem? you are having exactly. What goes wrong?
Im not able to read the image....im tryin to read image path from a text file....and load it in to a wand...but its not loading the image into the wand.. its giving me status problem...im reading the string from the text file in to str and passing it as an argument to the MagicKReadImage()..
anthony wrote:Are you permission right. What exception errors are you getting, that will tell you what is going wrong!
Its just saying status problem..nothing more...and when im writing image..its not writing just one image..its reproducing multiple images.....each time
anthony wrote:Are you permission right. What exception errors are you getting, that will tell you what is going wrong!
Its just saying status problem..nothing more...and when im writing image..its not writing just one image..its reproducing multiple images.....each time
Thank you for helpin...
i figured out how to read the images...but im stuck at writing the output to a different image each time....its wiriting the results to same file over and over each time.
From what I can tell @ syntax will not work with any filename containing a directory separator. That is it is restricted to the current directory, and the filename needs to reflect this.
This may be a security measure, though I do not have any definitive answer on this, nor have to reviewed the code. Though I will be at some point as part of my part in the ongoing IMv7 Redevelopment.
anthony wrote:From what I can tell @ syntax will not work with any filename containing a directory separator. That is it is restricted to the current directory, and the filename needs to reflect this.
This may be a security measure, though I do not have any definitive answer on this, nor have to reviewed the code. Though I will be at some point as part of my part in the ongoing IMv7 Redevelopment.
Thanks anthony for your suggestions...i have finally figured how to read and write different images....by reading filepaths from a file.