April 13, 2020

Programming - enstars.info

Revisiting OCR and Bad Translations

With the updated games and new story, thought some hilarious translations might make the content more readable.

Spent some time remembering how I did anything. I have one gimp macro that resizes the screenshots for the display images. This expects the title slide to be the first slide. Also have to lpad the first ten images with 0s. Those get renamed 1_01.jpg and the uploaded to images/translations.

Using the same raw source, there are two other gimp macros. One to cut the right and top side of the image off. And then a second one to cut the left and bottom off. Unfortunately gimp doesn't let you do two crops in one macro. The star is still there and causing noise.

There is then the translate.js node script. My google API credit ran out but it let me make calls no problem, shouldn't cost more than $1.

Each time the script is run, need to update the source images, destination name, and how many slides per chapter. This then spits out the JSON.

I should break the script into two, one with translate and one without to be more useful to others.

Got chapter 3 all set up though, only 127 more to go of the (so far) released chapters. At least the first event is only 9 and scout only 8!

Time Spent: 2 hours

March 14, 2019

Programming - enstars.info

Laravel error email stopped working

OK SO, it was using env() to read the email from the .env file BUT this doesn't work when things are cached which usually happens on production

SO I created a new config file enstars.php and created a mail address in there that reads from the .env file, this way even the cached ones know it

it is sending the emails out i see them in mailgun but only one has shown up in my mailbox so far??? Maybe this is some gmail rate limiting thing? cause one worked the next day

Time Spent: 1 days 4 hours 40 minutes

May 31, 2018

Programming - enstars.info

Pulling text out of story screen shots

I looked into this project last night, and finally got a working concept tonight!

Steps of mostly failure:

  1. Look for a way to pull text from images in PHP
  2. Find stack overflow mentioning Tessarect OCR https://stackoverflow.com/questions/2024238/read-text-from-an-image-with-php
  3. Go to wrapper mentioned https://github.com/thiagoalessio/tesseract-ocr-for-php
  4. Not understanding how it worked at all, I added it to my Laravel project through composer, but that didn't work.
  5. I then downloaded it on my mac through homebrew, this took a long time
  6. Decided to move this process to my windows box with more power
  7. Now late Thursday night
  8. Install Chocolatey package manager for windows through power shell
  9. Install the recommended windows package for tesseract
  10. Try to boot up my local xampp install, its completey broken.
  11. Abandon PHP, look for node package.
  12. There is one! http://tesseract.projectnaptha.com/
  13. Create a new project folder and install it
  14. Can't remember how to create projects from scratch in node, eventually remember how to run just the file name.
  15. Download example image, run test code, ERROR! Eng not found.
  16. Google around, no luck, just look through recent github issues and bingo! https://github.com/naptha/tesseract.js/issues/194
  17. Add in missing file
  18. rerun AND IT READS ENGLISH!!!
  19. Okay lets try Japanese, change language to Jpn, get language file
  20. Run and its completely garbled
  21. Move to browser as ghetto windows node shell probably can't handle Japanese font
  22. Some success but mostly garbled result!
  23. Crop picture so it's just the text
  24. Rerun - IT WORKS O M G

I can't believe I got it working! It was probably 3 hours of messing around over two nights, switching to JavaScript was the solution all along!

Next step is to start automating things, image cropping, file running, and then saving the text!

Time Spent: 2 hours 16 minutes