mchehab / zbar

ZBar is an open source software suite for reading bar codes from various sources, including webcams. As its development stopped in 2012, I took the task of keeping it updated with the V4L2 API. This is the main repository for it. There's a clone at at LinuxTV.org, and another one at gitlab.
https://linuxtv.org/downloads/zbar/
GNU Lesser General Public License v2.1
1k stars 205 forks source link

Feature: scan image from clipboard or screen #292

Open joshgold22 opened 3 months ago

joshgold22 commented 3 months ago

Would it be possible (or is it already) to read an image directly from the clipboard without having to save as a file (might use a temp file internally)

Similarly, would it be possible to just run a zbar command when there's a QR visible somewhere on the screen, without even copying to clipboard?

danielwerg commented 3 months ago

If you are use wl-clipboard you can do this:

wl-paste | zbarimg -

and

slurp | grim -g - - | zbarimg - --raw -q
joshgold22 commented 3 months ago

Thanks for the idea, I think this will work analogously as a workaround on mac osx — I was able to use it to dump the raw png file data to a pipe. getclipb PNGf | ... https://apple.stackexchange.com/a/375353/19289 macos - What's the quickest way to get a graphic on the clipboard saved to disk? - Ask Different

I can't confirm, though, because I'm new to zbar, and I see zbarimg is not working for me even with image files saved on disk, (including -S*.enable)

(Assuming I get zbar woriking, I still think it could be nice to have these two capacities built in, but perhaps they would require a lot of OS-specific tweaking.)