Open sinall opened 1 year ago
You should only use pixReadWithHint() for jpeg compressed image files. See the documentation.
I have no trouble reading with 1.83 on linux. What are the error messages?
You should only use pixReadWithHint() for jpeg compressed image files. See the documentation.
I have no trouble reading with 1.83 on linux. What are the error messages?
That is bmp
file, not jpeg. How can I get error message?
You should only use pixReadWithHint() for jpeg compressed image files. See the documentation.
I have no trouble reading with 1.83 on linux. What are the error messages?
I use leptSetStderrHandler
to capture the error:
Error in pixReadMemBmp: 32 bpp rgba input data is not supported
You're right. I enabled handling rgba in bmp after 1.83. If you build from the github master it will work for you.
You're right. I enabled handling rgba in bmp after 1.83. If you build from the github master it will work for you.
OK, I'm using conan right now, will try when new version is available in Conan.
@DanBloomberg BTW, is this the correct way to enable exception(or get error)?
void lept_default_stderr_handler(const char *formatted_msg)
{
throw std::runtime_error(formatted_msg);
}
leptSetStderrHandler(lept_default_stderr_handler);
No, that's a static function that you have modified. See prog/messagetest.c for usage.
No, that's a static function that you have modified. See prog/messagetest.c for usage.
OK, I can use a different name (e.g CustomErrorHandler
) for the function. Is that the correct way to enable exception?
I don't know what you're trying to do. This utility is a messaging system for use when errors occur. There should be no need to modify or add functions to the library. Again, see prog/messagetest.c for examples of usage.
I don't know what you're trying to do. This utility is a messaging system for use when errors occur. There should be no need to modify or add functions to the library. Again, see prog/messagetest.c for examples of usage.
I'm trying to get error message or get exception from leptonica. those code goes to my code not library. If I don't do that, I can not get error message. For example, the pixRead returns 0, I don't know why!
By default, all error messages go to stderr, so you should see them. This callback utility just allows you to send the error message to some other stream, or with NULL to skip them.
Again, I suggest you look at the Runtime redirection of stderr in utils1.c, and the examples of usage in prog/messagetest.c.
One more thing. Leptonica also has an elaborate mechanism for controlling the severity of messages that are output. By default, all info, warning and error messages are output. This can be changed by the mechanism described in environ.h under Control printing of error, warning and info messages and you can do it either on the compiler command line or dynamically during the running of the program.
I'm using 1.83.0 with VC2022 on Windows 11.
pixReadWithHint("captcha-001.bmp", IFF_BMP);
returns NULL.captcha-001.zip