Magick++ cant read jpg file with extended ascii characters

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
rkaufmann

Magick++ cant read jpg file with extended ascii characters

Post by rkaufmann »

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.

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;
}
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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Magick++ cant read jpg file with extended ascii characters

Post by magick »

ImageMagick requires UTF-8 filenames. Someone claimed they had a patch to handle standard Windows filenames, but they never submitted it.
Post Reply