Page 1 of 1

Crash on function "read("...")"

Posted: 2016-11-01T04:48:47-07:00
by Vasyl
Hello. Could you please, help me? I use ImageMagick 6.9.6 on Windows in my Qt project. Everything runs perfectly except for the

Code: Select all

Magick::Image image; image.read("2.jpg")
function. Intercepted exception looks like this

Code: Select all

consolemagick.exe: UnableToOpenBlob `2.jpg': No such file or directory @ error/blob.c/OpenBlob/2705
Help me please in solving this problem… Below is the example of the code of simple console application in QtCreator

Code: Select all

#include <iostream>
#include <Magick++.h>
#include <Magick++/Image.h>
#include <Magick++/Blob.h>
#include <magick/blob.h>
using namespace std;

int main(int argc, char *argv[])
{
    Magick::InitializeMagick(*argv);

    cout << "Hello World!" << endl;
    Magick::Image img;
    try{
    img.read("2.jpg");
    }catch(Magick::Exception &error_){
        cout<<error_.what();
        return 1;
    }
    cout<<img.geometry().width();
    return 0;
}

Re: Crash on function "read("...")"

Posted: 2016-11-01T05:17:25-07:00
by snibgo
Vasyl wrote:No such file or directory
Do you have a file named 2.jpg in that directory?

Re: Crash on function "read("...")"

Posted: 2016-11-01T05:34:47-07:00
by Vasyl
Yes , of course)

Re: Crash on function "read("...")"

Posted: 2016-11-01T06:11:33-07:00
by snibgo
What do "dir" and "identify" show for that file?