maxenxe / HQ-Trivia-Bot-NOT-MAINTAINED-

Small NodeJS bot for HQ Trivia
24 stars 13 forks source link

Screenshot Done : Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "screenshot.jpg" "-crop" "top-left-xxtop-left-y+the result x+the result y" "answers.jpg" this most likely means the gm/convert binaries can't be found #2

Closed desireend closed 6 years ago

maxenxe commented 6 years ago

Try reinstalling it ( npm install -g gm)

desireend commented 6 years ago

Nope. It still is giving issues.

maxenxe commented 6 years ago

If you're using Windows add gm to your PATH, follow the process given in the last closed issue

anishrajeev commented 6 years ago

I am getting same error but i am on iphone 6 and mac

anishrajeev commented 6 years ago

can anyone help

anishrajeev commented 6 years ago

Anishs-MacBook-Pro:HQ-Trivia-Bot-master anish$ npm start

hqtriviabot@1.0.0 start /Users/anish/Downloads/HQ-Trivia-Bot-master node bot.js

Screenshot done Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "screenshot.jpg" "-crop" "351x233+606+334" "answers.jpg" this most likely means the gm/convert binaries can't be found at ChildProcess. (/Users/anish/Downloads/HQ-Trivia-Bot-master/node_modules/gm/lib/command.js:232:12) at ChildProcess.emit (events.js:160:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:207:12) at onErrorNT (internal/child_process.js:389:16) at process._tickCallback (internal/process/next_tick.js:152:19)

chaoscreater commented 6 years ago

There needs to be better instructions / documentations. Tried reinstalling with npm install -g gm and still not working. No errors found in reinstallation.

I've added W:\HQ-Trivia-Bot-master\node_modules\gm to the environmental path already, still doesn't work.

chaoscreater commented 6 years ago

I've gotten it to work. Download this: http://www.graphicsmagick.org/

It should be a .exe that you install for Windows. During the installation step, it'll ask you to add to environmental path.

Close your powershell / command prompt and relaunch it and run node bot.js. It should work now and generate a answers.jpg in the same folder. However, now I'm getting a "'tesseract' is not recognized as an internal or external command, operable program or batch file."

Update:

Looks like tesseract is the one that's used to do OCR on the image.

Update:

Got it to work fully.

Download this: https://github.com/tesseract-ocr/tesseract/wiki/4.0-with-LSTM#400-alpha-for-windows

Then add these 2 paths to the Path system environmental variable: C:\Program Files (x86)\Tesseract-OCR C:\Program Files (x86)\Tesseract-OCR\tessdata

Bloody hell, these should be instructions included in the original post.

Update:

OK, so looks like all this does is lookup answers on Wikipedia. Unlike other bots, it doesn't predict or tell you which answer is the correct one. It reads the question and does the scanning somewhat OK, there are a few characters that it misses during the OCA scan.

I'd just use other bots if I were you guys.

maxenxe commented 6 years ago

Hey, the bot research the question and look for number of occurrences for the answer, if it finds a Wikipedia website it search on the page for answers, I agree that the OCR is not really accurate but, did it for the fun 🙃

tdaddy commented 6 years ago

did everything @chaoscreater said to do and still get this error

Screenshot done Answers resized node-tesseract: Running 'tesseract answers.jpg C:\Users\Topher\AppData\Local\Tem p\tmp-1876L7qoo2V9IDKS' node-tesseract: Preprocessor cleanup { Error: Command failed: tesseract answers.jpg C:\Users\Topher\AppData\Local\Tem p\tmp-1876L7qoo2V9IDKS 'tesseract' is not recognized as an internal or external command, operable program or batch file.

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

killed: false, code: 1, signal: null, cmd: 'tesseract answers.jpg C:\Users\Topher\AppData\Local\Temp\tmp-1876L 7qoo2V9IDKS' }

maxenxe commented 6 years ago

If you look to your error it isn't the same, your error is because of tesseract, you must add tesseract to your environment variables, please take a look to the previous issues for further solutions

maxenxe commented 6 years ago

(https://github.com/maxenxe/HQ-Trivia-Bot/issues/1)

tdaddy commented 6 years ago

i did everything in the previous issues too

maxenxe commented 6 years ago

Can you copy/paste here your PATH ?