DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.72k stars 384 forks source link

pixRead() can't read png images #742

Closed lazulkia closed 3 months ago

lazulkia commented 3 months ago

I have been using leptonica1831.dll in my scripts. Today I downloaded the latest dll generated by actions https://github.com/DanBloomberg/leptonica/actions/runs/8591084071

I found that it can read jpg's normally but not png's, either pixRead() pixReadMem() pixReadMemPng(). Of course leptonica1831.dll can read png images normally.

May I ask what is causing this?

DanBloomberg commented 3 months ago

I have no idea. Please send a complete log of your build, as well as the output to stderr of your runtime failures.

zdenop commented 3 months ago

Without detailed description & code (step by step to reproduce problem) nobody can tell you why your process fails.

lazulkia commented 3 months ago

Sorry, I'm a layman in programming, I just called it in a script and can't provide any more information.

If anyone wishes to reproduce it, they can test it with AutoHotkey-V2:

    DllCall("SetDllDirectoryW", "Str", "C:\Users\Administrator\Downloads\leptonica-1.84.1-45-g96ad9217-VS2019_win64\bin")
    DllCall("LoadLibraryW", "Str", "leptonica-1.84.1.dll", "Ptr")

    MsgBox hPix := DllCall("leptonica-1.84.1.dll\pixRead", "astr",  "D:\1.png"  , "Ptr")

It should be added that the problem originally came from tesseract-ocr, which was using leptonica-1.84.1.dll which was unable to read the png. I found the library, downloaded the latest dll, and found that it was still unreadable.

zdenop commented 3 months ago

First of all Github Action (GA) artifacts MUST NOT to be used for any other reason than analyzing GA! Next you should use (any) library properly e.g. to see output messages. So you could see would see this: Error in pixReadStreamPng: function not present. Which leads to log: https://github.com/DanBloomberg/leptonica/actions/runs/8591084071/job/23539423610 where is clear that png was not compiled (=>linked to leptonica). GA should be fixed now.

lazulkia commented 3 months ago

Thank you. I didn't find the released version of leptonica.dll in this library, does that mean I have to compile it myself, which is very difficult for me.