zbarimg is a helpful command line tool that can take an image of a QR code and decode the underlying text represented by the code.

zbarimg qr-code.png

This is helpful if you want to decode a Google Authenticator TOTP (Time-based one time password), or any other sort of QR code content.

It should be noted that saving the seed for TOTP codes may open you up to a security vulnerability, but there may be cases when you want this information.

zbarimg can not only decode an image of a QR code, but a screenshot that contains a QR code. So if you cannot save the QR code as an image, you can simply take a screenshot and pass that to zbarimg.

zbarimg screenshot.png

Feel free to try it on this example QR code here.


This QR code should decode to this content.


See also zbarcam.