Rxing (Rxing v0.1.0)

Copy Markdown View Source

Decodes supported barcodes from image binaries and files.

Use decode/2 for every result, decode_one/2 for the first result, and decode_file/2 to read and decode a file. Use formats/0 to inspect the barcode formats guaranteed by this package.

Summary

Types

A barcode format guaranteed by rxing.

A stable error returned by a decoding operation.

Functions

Decodes every supported barcode in an image binary.

Decodes every supported barcode in an image file.

Decodes the first supported barcode in an image binary.

Returns the barcode formats guaranteed by this package.

Types

format()

@type format() :: :qr_code | :data_matrix | :code_128 | :ean_13

A barcode format guaranteed by rxing.

reason()

@type reason() ::
  :invalid_image
  | {:unsupported_format, term()}
  | {:invalid_option, atom()}
  | {:limit_exceeded,
     :max_input_bytes
     | :max_width
     | :max_height
     | :max_pixels
     | :max_alloc_bytes}
  | {:file, File.posix()}
  | :internal_error

A stable error returned by a decoding operation.

Functions

decode(binary, options \\ [])

@spec decode(
  binary(),
  keyword()
) :: {:ok, [Rxing.Result.t()]} | {:error, reason()}

Decodes every supported barcode in an image binary.

decode_file(path, options \\ [])

@spec decode_file(
  Path.t(),
  keyword()
) :: {:ok, [Rxing.Result.t()]} | {:error, reason()}

Decodes every supported barcode in an image file.

decode_one(binary, options \\ [])

@spec decode_one(
  binary(),
  keyword()
) :: {:ok, Rxing.Result.t()} | {:error, :not_found | reason()}

Decodes the first supported barcode in an image binary.

formats()

@spec formats() :: [format()]

Returns the barcode formats guaranteed by this package.