// SPDX-FileCopyrightText: 2022 Shun Sakai
//
// SPDX-License-Identifier: CC-BY-4.0

= qrtool-decode(1)
// Specify in UTC.
:docdate: 2025-06-07
:revnumber: 0.13.1
:doctype: manpage
:mansource: qrtool {revnumber}
:manmanual: General Commands Manual
ifndef::site-gen-antora[:includedir: ./include]
:qrcode-url: https://www.qrcode.com/
:enwp-url: https://en.wikipedia.org
:enwp-article-url: {enwp-url}/wiki
:w3-url: https://www.w3.org
:bmp-url: {enwp-article-url}/BMP_file_format
:dds-url: {enwp-article-url}/DirectDraw_Surface
:farbfeld-url: https://tools.suckless.org/farbfeld/
:gif-url: {enwp-article-url}/GIF
:radiance-rgbe-url: {enwp-article-url}/RGBE_image_format
:ico-url: {enwp-article-url}/ICO_(file_format)
:jpeg-url: https://jpeg.org/jpeg/
:openexr-url: https://openexr.com/
:png-url: {enwp-article-url}/PNG
:pnm-url: https://netpbm.sourceforge.net/doc/pnm.html
:qoi-url: https://qoiformat.org/
:svg-url: {w3-url}/Graphics/SVG/
:tga-url: {enwp-article-url}/Truevision_TGA
:tiff-url: {enwp-article-url}/TIFF
:webp-url: https://developers.google.com/speed/webp/
:xbm-url: {enwp-article-url}/X_BitMap
:image-crates-url: https://crates.io/crates/image

== NAME

qrtool-decode - detect and decode a QR code

== SYNOPSIS

*qrtool decode* [_OPTION_]... [_IMAGE_]

== DESCRIPTION

This command detects and decodes a {qrcode-url}[QR code] from a raster or
vector image. By default, the result will be output to standard output.

.Supported image file formats
* {bmp-url}[BMP] (if enabled at compile time)
* {dds-url}[DDS] (if enabled at compile time)
* {farbfeld-url}[Farbfeld] (if enabled at compile time)
* {gif-url}[GIF] (if enabled at compile time)
* {radiance-rgbe-url}[Radiance RGBE] (if enabled at compile time)
* {ico-url}[ICO] (if enabled at compile time)
* {jpeg-url}[JPEG] (if enabled at compile time)
* {openexr-url}[OpenEXR] (if enabled at compile time)
* {png-url}[PNG]
* {pnm-url}[PNM] (if enabled at compile time)
* {qoi-url}[QOI] (if enabled at compile time)
* {svg-url}[SVG] (if enabled at compile time)
* {tga-url}[TGA] (if enabled at compile time)
* {tiff-url}[TIFF] (if enabled at compile time)
* {webp-url}[WebP] (if enabled at compile time)
* {xbm-url}[XBM] (if enabled at compile time)

Use *-t* option to specify the image format. If this option is not specified,
the image format is determined based on the extension or the magic number.

== POSITIONAL ARGUMENTS

_IMAGE_::

  Input image file. If _IMAGE_ is not specified, or if "-" is specified, the
  image will be read from standard input. Supported raster image formats are
  based on the formats supported by the {image-crates-url}[`image`] crate. The
  format of _IMAGE_ is determined based on the extension or the magic number if
  possible. If the format cannot be determined, use *--type*. Note that the SVG
  image is rasterized before scanning.

== OPTIONS

*-t*, *--type* _FORMAT_::

  The format of the input. If _FORMAT_ is not specified, the format is
  determined based on the extension or the magic number.

  The possible values are:{blank}:::

    *bmp*::::

      Windows Bitmap. This value is available if the `decode-from-bmp` feature
      is enabled at compile time.

    *dds*::::

      DirectDraw Surface. This value is available if the `decode-from-dds`
      feature is enabled at compile time.

    *farbfeld*::::

      Farbfeld. This value is available if the `decode-from-ff` feature is
      enabled at compile time.

    *gif*::::

      Graphics Interchange Format. This value is available if the
      `decode-from-gif` feature is enabled at compile time.

    *hdr*::::

      Radiance RGBE. This value is available if the `decode-from-hdr` feature
      is enabled at compile time.

    *ico*::::

      ICO file format. This value also includes the CUR file format. This value
      is available if the `decode-from-ico` feature is enabled at compile time.

    *jpeg*::::

      JPEG. This value is available if the `decode-from-jpeg` feature is
      enabled at compile time.

    *openexr*::::

      OpenEXR. This value is available if the `decode-from-exr` feature is
      enabled at compile time.

    *png*::::

      Portable Network Graphics.

    *pnm*::::

      Portable Anymap Format. This value is available if the `decode-from-pnm`
      feature is enabled at compile time.

    *qoi*::::

      Quite OK Image Format. This value is available if the `decode-from-qoi`
      feature is enabled at compile time.

    *svg*::::

      Scalable Vector Graphics. This value also includes the gzip-compressed
      SVG image. This value is available if the `decode-from-svg` feature is
      enabled at compile time.

    *tga*::::

      Truevision TGA. This value is available if the `decode-from-tga` feature
      is enabled at compile time.

    *tiff*::::

      Tag Image File Format. This value is available if the `decode-from-tiff`
      feature is enabled at compile time.

    *webp*::::

      WebP. This value is available if the `decode-from-webp` feature is
      enabled at compile time.

    *xbm*::::

      X BitMap. This value is available if the `decode-from-xbm` feature is
      enabled at compile time.

*--verbose*::

  Also print the metadata. It is output to stderr. This option conflicts with
  *--metadata*.

*--metadata*::

  Print only the metadata. It is output to stderr. This option conflicts with
  *--verbose*.

*-h*, *--help*::

  Print help message. The short flag (*-h*) will print a condensed help message
  while the long flag (*--help*) will print a detailed help message.

*-V*, *--version*::

  Print version number.

ifndef::site-gen-antora[include::{includedir}/section-exit-status.adoc[]]
ifdef::site-gen-antora[include::partial$man/man1/include/section-exit-status.adoc[]]

== NOTES

Source repository:{blank}::

  https://github.com/sorairolake/qrtool

== EXAMPLES

Detect and decode a QR code from the given image:{blank}::

  $ *qrtool decode input.png*

Decode a QR code from the given WebP image:{blank}::

  $ *qrtool decode -t webp input.webp*

Also print the metadata when decoding a QR code:{blank}::

  $ *qrtool decode --verbose input.qoi*

ifndef::site-gen-antora[include::{includedir}/section-reporting-bugs.adoc[]]
ifdef::site-gen-antora[include::partial$man/man1/include/section-reporting-bugs.adoc[]]

ifndef::site-gen-antora[include::{includedir}/section-copyright.adoc[]]
ifdef::site-gen-antora[include::partial$man/man1/include/section-copyright.adoc[]]

== SEE ALSO

*qrtool*(1), *qrtool-completion*(1), *qrtool-encode*(1), *zbarimg*(1)
