houqp / leptess

Productive and safe Rust binding for leptonica and tesseract
https://houqp.github.io/leptess/leptess/index.html
MIT License
258 stars 28 forks source link

Show tesseract and leptonica version function? #46

Closed kvnxiao closed 2 years ago

kvnxiao commented 2 years ago

Does there currently exist a function that can fetch and show the currently used version of tesseract and leptonica? If not, this would be a great addition. I am using leptess in a GUI application and would like to be able to show this information in the "About" option popup.

It would be great if they could be included here as a wrapper to unsafe C_str conversion calls so that I don't have to explicitly declare dependencies on tesseract-sys + leptonica-sys and do:

unsafe {
    let tesseract_ver = CStr::from_ptr(tesseract_sys::TessVersion());
    let leptonica_ver = CStr::from_ptr(leptonica_sys::getLeptonicaVersion());
    let leptonica_libs_ver = CStr::from_ptr(leptonica_sys::getImagelibVersions());
    // ...
}
houqp commented 2 years ago

I don't think so, PRs welcome :)

ccouzens commented 2 years ago

leptonica-plumbing 0.6.0 and tesseract-plumbing 0.7.1 have both been published to support this

kvnxiao commented 2 years ago

Thanks! Will the Cargo.toml file here need to be updated to set tesseract-plumbing dependency version as ~0.7?

ccouzens commented 2 years ago

Thanks! Will the Cargo.toml file here need to be updated to set tesseract-plumbing dependency version as ~0.7?

It depends.

If you want to use the methods directly from tesseract-plumbing then you can add the dependency to your app.

If you want to add the methods to leptess, you will need to update leptess's dependencies (and add version methods).

kvnxiao commented 2 years ago

Thanks, I think we can leave it as is like this as part of the *-plumbing repositories.