Sign inSign up

paawak/tesseract-ocr-barebones

By paawak

•Updated almost 8 years ago

Dockerize Tesseract OCR in an Alpine Image. Care has been taken to reduce the size to a minimum.

Image
0

349

paawak/tesseract-ocr-barebones repository overview

This is an Apline 3.7 image, and contains the latest stable release of Tesseract OCR (https://github.com/tesseract-ocr/tesseract/⁠ ). Tesseract OCR is built from its sources and then installed in the Alpine image. The below supporting libraries are also built from their sources so that Tesseract runs fine:

  1. zlib-1.2.11.tar.gz (https://zlib.net/⁠)
  2. jpegsrc.v9c.tar.gz (http://www.ijg.org/⁠)
  3. libpng-1.6.34.tar.xz (http://www.libpng.org/pub/png/libpng.html⁠)
  4. tiff-4.0.9.tar.gz (http://www.libtiff.org/⁠)
  5. leptonica-1.76.0.tar.gz (http://www.leptonica.com/⁠)

It supports the below most popular image formats:

  1. PNG
  2. TIFF
  3. JPEG

This is how you run it:

docker run -it -v /full-path-to/sample-images:/input-output -e LANG=eng -e IMAGE=/input-output/english-text.tif -e OUTFILE=/input-output/output -e TESSDATA_PREFIX=/tesseract/tessdata/ paawak/tesseract-ocr-barebones:alpine_jre-8_tess-3.05.02_v0.1

Details

  1. Mapping the volume: While running this image you would need to map a volume to the directory /input-output, in order to specify the image files
  2. Specify the language with the LANG environment variable
  3. Specify the image file with the IMAGE environment variable
  4. Specify the output file with the OUTFILE environment variable
  5. Specify the tessdata directory with the TESSDATA_PREFIX environment variable. Use one in the mapped volume, or the one that is in-build in the image in the /tesseract/tessdata/

This image also contains the openjdk:8u171-jre-alpine3.7. So, you can use this image as a base for your Java application.

The sources can be found here: https://github.com/paawak/porua/tree/master/tesseract-ocr-docker⁠

Tag summary

Content type

Image

Digest

Size

142.3 MB

Last updated

almost 8 years ago

docker pull paawak/tesseract-ocr-barebones:alpine_jre-8_tess-4.0.0-rc2_v0.1