flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.67k stars 1.58k forks source link

[feature request] scan QR code from selected region #511

Open cdluminate opened 5 years ago

cdluminate commented 5 years ago

It would be better if flameshot can scan QR code from the selected region, and put the decoded text to clipboard.

cdluminate commented 5 years ago

Code reference: https://launchpad.net/qr-tools

holazt commented 5 years ago

@cdluminate Your idea is good, I will achieve it. Thanks again.

data-man commented 5 years ago

I think quirc is better. This library included to OpenCV.

greno4ka commented 5 years ago

Flameshot is a screenshot tool. Adding QR grabber to it will look like making knife and flashlight in one tool. IMHO, that's not a good idea. Better to concentrate attention on actual bugs and issues.

martianzhang commented 3 years ago

Ubuntu 20.04 can do this by following steps.

# install zbar-tools
sudo apt install zbar-tools

# qr-scan script
cat > qr-scan
#!/bin/bash

flameshot gui -r | zbarimg - | sed "s/^QR-Code://g" | xclip -selection clipboard 2>/dev/null
Ctrl+D

# add keyboard shortcut for qr-scan script
xstable commented 2 years ago

Definitely would love this feature as integrated option in flameshot. Alternatively it might be a good feature to have something like a queue, which pipe the image - that was created - to any script we'd like to. In this case we simply could create an entry "qr-codeScanner" and put the zbarimg-stuff into it.

xstable commented 2 years ago

@martianzhang I had modified your suggestion to be able to analyse any still taken image (which inside xclip) for qr-code:

#!/bin/bash
xclip -selection clipboard -t image/jpeg -o | zbarimg - | sed "s/^QR-Code://g" | xclip -selection clipboard 2>/dev/null 

In my case, I do add it straight to the Klipper (KDE) as action: image

image

data-man commented 2 years ago

I think zbarimg - | sed "s/^QR-Code://g" can be replaced to zbarimg --raw -q.

mmahmoudian commented 2 years ago

@xstable

Alternatively it might be a good feature to have something like a queue, which pipe the image we create to every script we like. In this case we simply could create an entry "qr-codeScanner" and put the zbarimg-stuff into it.

This is already possible since version 8 if I don't make mistake. You can use flameshot gui --raw to output to stdout and pipe it to whatever you want. Some months ago I wrote a blog post in which I used this for reading barcode:

https://mehrad.ai/posts/20210702-extracting-payment-info-in-rasterized-invoice/

xstable commented 2 years ago

@mmahmoudian Ok, but I don't mean to create an own script which only use flameshot, I mean a section inside flameshot which do a predefined action based on the current made image.

For example there could be a button "A" for "Actions" and if you click on it, you can choose between the scripts you entered.

It's more handy in my opinion, as to have a shortcut on OS-Layer for each script, which finally use flameshot only internally. This way you all the time only open flameshot, but you are able to pipe the made image to every of the 1000000 ;) scripts you made. (Handy encapsulated below one single button in the flameshot-gui)

mmahmoudian commented 2 years ago

@xstable there have been active discussions about adding plugin support to Flameshot. If you are interested, I suggest searching them in the issues and discussions and also join our Matrix room to know the most recent discussions over there (#flameshot-org:matrix.org)

Btw, you might want to take a look at https://codeberg.org/mehrad/dmenu_shot to see if you can adopt that for your workflow

stefanocudini commented 2 years ago

I think this would be a great idea, a button that scan and copy to clipboard image

deron-dev commented 1 year ago

A temporary solution for anyone eager for this functionality:

If you have zbar and xclip installed, you can set up a keybind for this one-liner:

flameshot gui -r | zbarimg -1q --raw - | xclip -selection clipboard

This copies the QR code link decoded from the capture to your clipboard.

Scary-Guy commented 1 week ago

I'm glad to see I'm not the only one who has had this idea, I'm just sorry it took me this long to think of it.

I'm also sad that no tools have implemented this yet that I have seen.