DJVU problems

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?".
Post Reply
Lintworm2

DJVU problems

Post by Lintworm2 »

Dear all,

I am trying to create a mathlink module for Mathematica that can read files of the type DJVU. After a few days of trying I still have no success. This is what I've done so far:

Downloaded and compiled ImageMagick 6.5.4. (8 bit mode)
Downloaded and compiled DjvuLibre 3.5.22.

I added the define MAGICKCORE_DJVU_DELEGATE
Did some minor hacking (see below)

After compiling the code and linking it to my project, i tried reading the file using this code:

Code: Select all

void ImportDJVU()
{
	// Download values from the link
	const char * path;
	MLGetString(stdlink, &path);

	Magick::Image image;

	try 
	{
		// Read a file into image object
		image.read( path );
	}
	catch( Magick::Exception &error_ )
	{
		std::cout << "Caught exception: " << error_.what() << "\n";
	}

	MLPutString(stdlink, path);
	MLReleaseString(stdlink, path);
}
Don't worry about the ML functions, these arrange the acquisition of data from Mathematica, and work fine. Whe running the program I get this exception:

Code: Select all

Assertion failed: image_info->signature == MagickSignature, file ..\..\coders\djvu.c, line 765
After some fiddling around, I found out that the problem lies in the fact that image_info->signature is NULL and thus unequal to the MagickSignature. I cannot trace the stack for some reason, so I have no clue where this problem comes from. any help is very much appreciated...

Sincerely,
Gao Han


PS: Had to do some minor hacking otherwise I got into trouble with compiling (VS2008)

Code: Select all

 
   /* // Originally:
        q = (unsigned char *) malloc(lc->image->columns
#if RGB
                         * 3
#endif
                );*/
       // Changed into:
#if RGB
		q = (unsigned char *) malloc(lc->image->columns * 3);
#else
		q = (unsigned char *) malloc(lc->image->columns);
#endif
and also add the file "stdint.h" as it is not included with the standard distribution of VS2008
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: DJVU problems

Post by magick »

Can you post a URL to one or two of your DJVU images so we can download them and attempt to reproduce the problem. Thanks.
Post Reply