Magick++ cant read jpg file with extended ascii characters
Posted: 2009-12-02T08:06:42-07:00
I am having a problem with Magick++. I tried to create an Image object using a jpg file with extended acii characters in the name. The Image object is created successfully as there are no exceptions thrown. If I try to write the jpg out to a new file using the Image's write method the following exception is thrown "Empty JPEG image (DNL not supported) `C:\A.jpg' @ jpeg.c/EmitMessage/232". I attempted the same test with a copy of the jpg file in question and removed the extended acii characters and did not have any problems creating a new Image object or creating a new jpg file with the Image's write method.
Here is the code that I was using.
Is there any easy way arround this with out having to purify file names? I know I can read all the binary data out of the file and load it inot a blob and then create the Image object using the blob but I would really like to try and avoid that.
Here is the code that I was using.
Code: Select all
int main( int /*argc*/, char ** argv)
{
InitializeMagick(*argv);
try
{
Image objGoodFileName( "C:\\Euro Test.jpg" );
objGoodFileName.write("C:\\B.jpg");
Image objBadFileName( "C:\\Euro Test €üü.jpg" );
objBadFileName.write("C:\\A.jpg");
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}