DJVU problems
Posted: 2009-06-29T21:39:18-07:00
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:
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:
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)
and also add the file "stdint.h" as it is not included with the standard distribution of VS2008
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);
}
Code: Select all
Assertion failed: image_info->signature == MagickSignature, file ..\..\coders\djvu.c, line 765
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