logo       

Re: MagickReadImage() sets the image filename to a tmp filename: msg#00017

video.image-magick.bugs

Subject: Re: MagickReadImage() sets the image filename to a tmp filename

The problem seems to be from my previous call to MagickReadImageFile(), which
seems to set the
image filename to a temp filename.

Full program as requested:

/******************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wand/magick_wand.h>

int main( int argc,char **argv )
{
#define ThrowWandException( wand ) \
{ \
char \
*description; \
\
ExceptionType \
severity; \
\
description=MagickGetException( wand, &severity ); \
(void) fprintf( stderr, "%s %s %ld %s\n", GetMagickModule(),
description ); \
MagickRelinquishMemory( description ); \
DestroyMagickWand( wand ); \
exit( -1 ); \
}

FILE *img_file_handle;
MagickBooleanType status;
MagickWand *magick_wand;
char *img_filename;

img_file_handle = fopen( "./leaf.jpg", "r" );
if ( img_file_handle == (FILE *) NULL ) {
(void) fprintf( stderr, "could not open image file" );
exit(-1);
}

/* Read an image. */
magick_wand = NewMagickWand();

/* Problem apparently occurs here */
status=MagickReadImageFile( magick_wand, img_file_handle );
if ( status == MagickFalse ) {
ThrowWandException( magick_wand );
}

fclose( img_file_handle );

/* Start from the beginning... */
MagickResetIterator( magick_wand );

while ( MagickNextImage( magick_wand ) == MagickTrue ) {

/* ... and check each image for a filename */
img_filename = MagickGetImageFilename( magick_wand );

if ( img_filename == (char *) NULL ) {
ThrowWandException( magick_wand );
}

printf( "\n%s\n\n", img_filename );

MagickRelinquishMemory( img_filename );
}

DestroyMagickWand( magick_wand );
return( 0 );
}

/******************************************************/

Hope this helps

Again:
OS: Linux
IM version: 6.1.0-8 (Stable)


--- yarrow@xxxxxxxxxxxxxxxxxxxxxx wrote:

> > magick_wand = NewMagickWand();
> > MagickReadImage( magick_wand, "./leaf.jpg" );
> > printf( "%s", MagickGetImageFilename( magick_wand ) );
>
> If I run just this code, it outputs leaf.jpg. If you can assemble a small
> MagickWand program that shows a temporary filename rather than its original
> filename, we will try to reproduce the problem locally and fix it.
>




_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise