Create and read QR codes from the terminal

The QR codes ... we see them every day in some other place, they are those images that seem pixelated where there is only black and white color (white being the background). Thanks to them we can convert text to an image, something like this:

From Linux.net… let's use linux to be free!

It would be equal to:

qrcode

How to generate QR codes with the terminal?

For this we will use a package called qrencode, we must first install it.

If you use ArchLinux, Chakra or some derivative it would be:

sudo pacman -S qrencode

If you use Ubuntu, Debian or similar:

sudo apt-get install qrencode

Once installed we just have to run in a terminal:

qrencode "Texto a codificar!" -o $HOME/codigoqr.png

This will generate in our home a png file called codigoqr, which will be the result of the conversion of the text that we just put 😉

And how do I decode QR and convert to readable text?

For the reverse process we will use another application called zbar-img, which we will have available after installing the zbar package in Arch or zbar-tools in Ubuntu.

If you use ArchLinux, Chakra or some derivative it would be:

sudo pacman -S zbar

If you use Ubuntu, Debian or similar:

sudo apt-get install zbar-tools

Once installed we just have to run in a terminal:

zbarimg $HOME/codigoqr.png

This will show us something like:

zbarimg And as you can see, it perfectly shows us the text that we had coded 😉

The end!

EEENNNN FFFIIINN !!! 😀

This has been the tutorial, I hope it has been useful to you.

regards


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

12 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   eliotime3000 said

    I liked this application. I'll keep it in mind.

  2.   Nemesis said

    Your contribution is interesting !!! This is something that can prove to be useful.
    But is it possible to create the .png file in a directory other than $ HOME?

    1.    neysonv said

      what is after the -o is the directory so you can put whatever you want. you could for example put the file in your download folder with
      qrencode "text" -o Downloads / qr.png
      assuming clear that you are in your home
      For more info consult the manpage
      man qrencode

      1.    Nemesis said

        Thanks for the reply !!! I already tried it and it worked for me.

  3.   Manuel R. said

    I had been looking for something like that for a long time, easier impossible 😉
    Thanks for sharing, greetings.

  4.   Sander said

    It couldn't be easier, but it wasn't for me xD
    Another day I see it more calmly than the boss stalks….

  5.   Lenin Hernandez said

    Generate QR code from postgreSQL with Perl

    http://leninmhs.wordpress.com/2014/03/25/qr-postgres-perl/

  6.   mat1986 said

    I do not know if it was a slip that I had, but I thought that German Garmendia had come to FromLinux xDD.

    Other than that, interesting application. I'll find a way to take advantage of it 🙂

  7.   Gonzalo M said

    Interesting !! 😀

  8.   Luis said

    I made this script for zenity, it couldn't be easier. 😉

    #! / Bin / sh
    # Graphic script for qrencode
    url = `zenity –entry –title =» QRencGui »–text =» Enter the url: »`

    if [$? = 0]; then

    qrencode "$ url" -o ~ / QRCode.png | zenity –progress –press –auto-close –auto-kill –title = »QRencGui» –text = »Creating the $ url code \ n»

    zenity –info –title = »QRencGui» –text = »$ url QRcode image has been created»
    fi
    exit 0

    1.    Lenin Hernandez said

      Excellent!

  9.   rag said

    Excellent, it served me a lot, I was just investigating how I could do that