GithubHelp home page GithubHelp logo

deltadecay / barcodescanner Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 29 KB

Barcodescanner is a command line tool which scans barcodes (EAN-13 and UPC-A) from image files and outputs json.

Makefile 7.67% Go 92.33%

barcodescanner's Introduction

Build

A simple barcode scanner

This command line tool reads images (bmp, gif, jpeg, png, tiff, webp) from the command line and outputs a json result with information whether a barcode was found or if there were errors.

Go

To build it requires go. It has been tested with go 1.21. Perform go mod tidy to get dependencies.

Run and build

You can run without building a binary

go run . yourimagefile.jpg

If you want to build binaries use the Makefile and then run the executable.

./build/barcodescanner.darwin.arm64 yourimagefile.jpg

Usage

Usage of barcodescanner:
barcodescanner [flags] file...

This tool scans for barcodes (EAN-13 and UPC-A) in the specified files.
The argument file... is one or more image files to scan. Supported image formats
are: bmp, gif, jpeg, png, tiff, webp.

Optional flags:
  --grey
                Convert image to greyscale. Applied first.
  --scale
                Factor to resize the image with. Default 1.0 has no effect. Applied second.
  --unsharpen
                Apply unsharp mask. Four params comma separated: radius, sigma, amount, threshold. Applied third.
  --contrast
                Factor to adjust the contrast. Default 1.0 has no effect. Applied last.
  --pretty
                Pretty-print the json output
  --version
                Display version
  -h, --help
                Display this help

Example

./barcodescanner.darwin.arm64 --pretty upc1.jpg dvd1_back.jpg

Scanning two images, one with a barcode and one where it cannot be detected generates this json:

{
   "barcodes": [
      {
         "file": "upc1.jpg",
         "format": "UPC_A",
         "data": "883929215768",
         "country": "US/CA"
      },
      {
         "file": "dvd1_back.jpg",
         "error": "NotFoundException"
      }
   ]
}

barcodescanner's People

Contributors

deltadecay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.