https://github.com/otiai10/gosseract
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library
https://github.com/otiai10/gosseract
go ocr ocr-server tesseract tesseract-ocr
Last synced: 4 days ago
JSON representation
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library
- Host: GitHub
- URL: https://github.com/otiai10/gosseract
- Owner: otiai10
- License: mit
- Created: 2013-10-11T07:27:53.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T23:56:26.000Z (19 days ago)
- Last Synced: 2025-04-02T01:14:00.831Z (11 days ago)
- Topics: go, ocr, ocr-server, tesseract, tesseract-ocr
- Language: Go
- Homepage: https://pkg.go.dev/github.com/otiai10/gosseract
- Size: 1.08 MB
- Stars: 2,830
- Watchers: 51
- Forks: 293
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-go - gosseract - Go package for OCR (Optical Character Recognition), by using Tesseract C++ library. (Machine Learning / Search and Analytic Databases)
- zero-alloc-awesome-go - gosseract - Go package for OCR (Optical Character Recognition), by using Tesseract C++ library. (Machine Learning / Search and Analytic Databases)
- awesome-pdf - gosseract
- awesome-go - gosseract - Go package for OCR (Optical Character Recognition), by using Tesseract C++ library. Stars:`2.8K`. (Machine Learning / Search and Analytic Databases)
- awesome-golang-repositories - gosseract
- awesome-go - gosseract - Go package for OCR (Optical Character Recognition), by using Tesseract C++ library - ★ 657 (Machine Learning)
- awesome-go-extra - gosseract - 10-11T07:27:53Z|2022-08-22T03:05:18Z| (Machine Learning / Advanced Console UIs)
- awesome-go-zh - gosseract
README
# gosseract OCR
[](https://github.com/otiai10/gosseract/actions/workflows/go-ci.yml)
[](https://github.com/otiai10/gosseract/actions/workflows/runtime-docker.yml)
[](https://github.com/otiai10/gosseract/actions/workflows/runtime-vmactions.yml)
[](https://codecov.io/gh/otiai10/gosseract)
[](https://goreportcard.com/report/github.com/otiai10/gosseract)
[](https://codeclimate.com/github/otiai10/gosseract/maintainability)
[](https://github.com/otiai10/gosseract/blob/main/LICENSE)
[](https://pkg.go.dev/github.com/otiai10/gosseract/v2)Golang OCR package, by using [Tesseract](https://github.com/tesseract-ocr/tesseract) C++ library.
# OCR Server
If you need an [OCR server](https://github.com/otiai10/ocrserver) or want to see a working example of this package, there is a ready-made server application, which is very easy to deploy!
👉 https://github.com/otiai10/ocrserver
# Example
```go
package mainimport (
"fmt"
"github.com/otiai10/gosseract/v2"
)func main() {
client := gosseract.NewClient()
defer client.Close()
client.SetImage("path/to/image.png")
text, _ := client.Text()
fmt.Println(text)
// Hello, World!
}
```# Installation
1. [tesseract-ocr](https://github.com/tesseract-ocr/tessdoc), including library and headers
2. `go get -t github.com/otiai10/gosseract/v2`Please check this [Dockerfile](https://github.com/otiai10/gosseract/blob/main/Dockerfile) to get started.
Alternatively, you can deploy the pre-existing Docker image by invoking `docker run -it --rm otiai10/gosseract`.# Test
In case you have [tesseract-ocr](https://github.com/tesseract-ocr/tessdoc) installed on your local environment, you can run the tests with:
```
% go test .
```If you **DON'T** want to install tesseract-ocr on your local environment, run `./test/runtime` which utilises Docker and Vagrant to test the source code on some runtimes.
```
% ./test/runtime --driver docker
% ./test/runtime --driver vagrant
```Check [./test/runtimes](https://github.com/otiai10/gosseract/tree/main/test/runtimes) for more information about runtime tests.
# Issues
- [https://github.com/otiai10/gosseract/issues](https://github.com/otiai10/gosseract/issues?utf8=%E2%9C%93&q=is%3Aissue)