README.md
1# gosseract OCR
2<!-- [![Build Status](https://travis-ci.org/otiai10/gosseract.svg?branch=master)](https://travis-ci.org/otiai10/gosseract) -->
3[![Runtime Test](https://github.com/otiai10/gosseract/workflows/Runtime%20Test/badge.svg)](https://github.com/otiai10/gosseract/actions?query=workflow%3A%22Runtime+Test%22)
4[![codecov](https://codecov.io/gh/otiai10/gosseract/branch/master/graph/badge.svg)](https://codecov.io/gh/otiai10/gosseract)
5[![Go Report Card](https://goreportcard.com/badge/github.com/otiai10/gosseract)](https://goreportcard.com/report/github.com/otiai10/gosseract)
6[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/otiai10/gosseract/blob/master/LICENSE)
7[![Go Reference](https://pkg.go.dev/badge/github.com/otiai10/gosseract/v2.svg)](https://pkg.go.dev/github.com/otiai10/gosseract/v2)
8
9Golang OCR package, by using Tesseract C++ library.
10
11# OCR Server
12
13Do you just want OCR server, or see the working example of this package? Yes, there is already-made server application, which is seriously easy to deploy!
14
15 https://github.com/otiai10/ocrserver
16
17# Example
18
19```go
20package main
21
22import (
23 "fmt"
24 "github.com/otiai10/gosseract/v2"
25)
26
27func main() {
28 client := gosseract.NewClient()
29 defer client.Close()
30 client.SetImage("path/to/image.png")
31 text, _ := client.Text()
32 fmt.Println(text)
33 // Hello, World!
34}
35```
36
37# Install
38
391. [tesseract-ocr](https://github.com/tesseract-ocr/tesseract/wiki), including library and headers
402. `go get -t github.com/otiai10/gosseract`
41
42Check [Dockerfile](https://github.com/otiai10/gosseract/blob/master/Dockerfile) for more detail of installation, or you can just try by `docker run -it --rm otiai10/gosseract`.
43
44# Test
45
46In case you have [tesseract-ocr](https://github.com/tesseract-ocr/tesseract/wiki) on your local, you can just hit
47
48```
49% go test .
50```
51
52Otherwise, if you **DON'T** want to install tesseract-ocr on your local, kick `./test/runtime` which is using Docker and Vagrant to test the source code on some runtimes.
53
54```
55% ./test/runtime --driver docker
56% ./test/runtime --driver vagrant
57```
58
59Check [./test/runtimes](https://github.com/otiai10/gosseract/tree/master/test/runtimes) for more information about runtime tests.
60
61# Issues
62
63- [https://github.com/otiai10/gosseract/issues](https://github.com/otiai10/gosseract/issues?utf8=%E2%9C%93&q=is%3Aissue)
64