Readit News logoReadit News
Gormo · a year ago
I use Flameshot combined with Tesseract and zbarimg to quickly clip areas of the screen and either OCR them or decode barcodes, which I then map to hotkey combinations.

For example, I have `bash -c 'flameshot gui -s -r | tesseract - - | gxmessage -title "Decoded Data" -fn "Consolas 12" -wrap -geometry 640x480 -file -'` mapped to Super+O, so I can just press the key combo, select a region of the screen, and have the OCRed text immediately displayed in a dialog box from gxmessage (which accounts for most of the command line). Replace 'tesseract' with 'zbarimg' and you have a barcode scanner.

noisy_boy · a year ago
Great idea - I ended up experimenting to improve the ocr accuracy:

    #!/bin/bash

    screenshot=$(mktemp)
    decoded_data=$(mktemp)
    processed_data=$(mktemp)

    cleanup() {
        rm "$screenshot" "$decoded_data" "$processed_data"
    }

    trap cleanup EXIT

    flameshot gui -s -r > "$screenshot"

    convert "$screenshot" \
        -colorspace Gray \
        -scale 1191x2000 \
        -unsharp 6.8x2.69+0 \
            -resize 500% \
        "$screenshot"

    tesseract \
        --dpi 300 \
        --oem 1 "$screenshot" - > "$decoded_data"

    grep -v '^\s*$' "$decoded_data" > "$processed_data"

    cat "$processed_data" | \
        xclip -selection clipboard

    yad --text-info --title="Decoded Data" \
        --width=940 \
        --height=580 \
        --wrap \
        --fontname="Iosevka 14" \
        --editable \
        --filename="$processed_data"

Gormo · a year ago
Nice! Once you start getting complex, a standalone script might be a good idea. But it should be noted that your ImageMagick processing can also be inserted into the original one-liner:

    bash -c 'flameshot gui -s -r | convert - -colorspace Gray -scale 1191x2000 -unsharp 6.8x2.69+0 -resize 500% png:- | tesseract - - | gxmessage -title "Decoded Data" -fn "Consolas 12" -wrap -geometry 640x480 -file -'

jasonni · a year ago
Last year, when I want to find a tool to do the sanpshot and OCR job, I found flameshot. However, the OCR feature hasn't been added as native function due to some issues I'm not very clear.

So I spent some time added the OCR function into flameshot. I didn't choose to compile tesseract into flameshot, but using the rest api way to call a server running remotely. The reason for this way is I also added llama.cpp translation feature after OCR.

Here're github repositories for my fork of flameshot and the OCR and translation server which is written causually in Rust.

https://github.com/jason-ni/flameshothttps://github.com/jason-ni/flameshot-ocr-server

rahimnathwani · a year ago
If you've installed Flameshot using homebrew on MacOS, this will do a similar thing:

  /opt/homebrew/Caskroom/flameshot/12.1.0/flameshot.app/Contents/MacOS/flameshot gui -s -r | tesseract - - | (text=$(cat) && osascript -e "display dialog \"$text\" with title \"OCR Result\" buttons {\"OK\"} default button \"OK\"")

Deleted Comment

pixelmonkey · a year ago
This is my go-to screenshot tool on Linux.

For Linux users who also use Google Photos already, you may not realize this but the Google Photos web app accepts paste from system clipboard via Ctrl+V in the browser. Thus, my workflow if I want to save a screenshot for later is to call up flameshot in rectangular selection mode (I bind it to the PrtScn key), select my screenshot area, Ctrl+C to copy it to clipboard, navigate to GPhotos web app via address bar / bookmark bar shortcut, and Ctrl+V to upload there.

The nice thing about this is that GPhotos recognizes it as a screenshot (so I can find it on my phone later, too, for example). And, GPhotos also automatically indexes any text within the screenshot, so free text search can often find it, too.

If I need the screenshot as a file for some other purpose, I'll navigate to it in GPhotos and use Shift+D to download it.

I can also use GPhotos to privately share the screenshot with someone via their email address, or get a tokenized link for it.

Just sharing this tip because I notice a lot of people hunt around for cloud storage for desktop screenshots. But Google Photos works pretty well for this purpose already, if you use the paste-to-upload trick!

qmarchi · a year ago
Looks like there's a Google Photos API, so you could concievably make a full chain to upload screenshots automatically.

https://developers.google.com/photos

xhrpost · a year ago
My employer uses Gmail/gdrive so I just use the gDrive sync tool to auto upload my entire screen shot folder.
brightball · a year ago
I just store screenshots to a Dropbox folder. It’s worked great for me for years with Flameshot.
geoka9 · a year ago
I use the following script (activated by a system-level shortcut key) to take a screenshot, upload to S3 bucket (using the minio client[0]) and place the URL in the X selection buffer, ready to be pasted:

  #!/bin/bash
  set -e
  dbus-update-activation-environment DISPLAY XAUTHORITY
  FNAME=`cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32`.png
  flameshot gui --raw > /tmp/$FNAME
  ~/go/bin/mc -q cp --attr x-amz-acl=public-read /tmp/$FNAME s3/your.s3.bucket/dir/$FNAME
  echo -n https://s3-us-west-2.amazonaws.com/your.s3.bucket/dir/$FNAME | xsel
[0] https://min.io/docs/minio/linux/reference/minio-mc.html

wzyboy · a year ago
I have a similar setup but with SHA256 hash of the file as the object key.
aendruk · a year ago
In mine the hash is encoded as z-base-32 and namespaced with an uncommon first character:

  $ publish example.png
  https://example.com/+umk3cm5cah5akbqeueq8914zimfktoih
And for when it matters, the filename can optionally be attached:

  $ publish --named example.png
  https://example.com/+umk3cm5cah5akbqeueq8914zimfktoih
  $ http --headers 'https://example.com/+umk3cm5cah5akbqeueq8914zimfktoih' | grep 'Content-Disposition'
  Content-Disposition: inline; filename="example.png"

sandinmyjoints · a year ago
I forget, do you pay for bandwidth serving from S3 in this case? I have been looking for a good screenshot hosting solution to replace Cloudup, which was perfect and still usually works but I figure it might stop any day now. My only worry would be the unlikely case of a surprise high bill from a screenshot gone viral or something along those lines.
mfkp · a year ago
My workflow uses SFTP to upload to a cheap webhost, with cloudflare in front acting as a cdn. Easy peasy
djbusby · a year ago
Doesn't R2 have no egress fee?
byteknight · a year ago
Implement a cloudflare cache infront?
endgame · a year ago
You may want to modernise your script because Bucket ACLs are disabled by default these days: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-...
AnthOlei · a year ago
I wonder: if we set a TTL on the image, and also make it require a signed link that gets copied the same way, is it now a secure & ephemeral service?
wackget · a year ago
Having briefly tried it I have to say it's not as clear or easy to use as ShareX (another open-source screenshot tool). The monochrome icons are really not intuitive or easy to discern at a glance.

Another commenter asks why it's not possible to trigger with the PrtScn key and I would also think that is an essential feature.

runsonrum · a year ago
I found it to be the exact opposite. ShareX has a lot of features which makes it hard to quickly get your head around all its clutter, when sometimes all you want to a screenshot utility.

Flameshot has key bindings just like any other screenshot program. If the shortcut is already bound by another program, then it will not let you bind it to Flameshot, I believe.

I have been using Flameshot portable for years and it isn't without missing features but I keep coming back to it. I generally use the copy function, sometimes save to location. It would be good to have a built in editor that can be loaded after the action.

Saris · a year ago
Why not just use the built in system screenshot tool if you just want to copy or save?

ShareX can pop up an editor after a screenshot which I do use a lot.

rcv · a year ago
I have the PrtScn key set up to open flameshot on my PopOS machine and it works great. I just followed the instructions here: https://flameshot.org/docs/guide/key-bindings/#on-ubuntu-and...
SubiculumCode · a year ago
Flameshot is the best. I'm never going back.

And configuring it to a the print screen button just involves assigning it, and in the case of Ubuntu, overriding system defaults.

rahimnathwani · a year ago
I recently switched my daily driver from Ubuntu to MacOS. I used PrtScrn to trigger Flameshot on Linux, and it was trivial to do the same on MacOS.

Perhaps it's harder on Windows?

smusamashah · a year ago
FYI, [Win + Shift + S] is quickest way in windows to copy selected area to clipboard, if that's all you need.

I use it nearly everyday for something e.g. posting snap of a code snippet or anything in slack to putting these clips in docs.

EDIT: Just tried Flameshot and loved that I can draw while taking a snap, instead of opening a new window and do the drawing in that. Looks like this is going to replace Win+Shift+S for me.

glonq · a year ago
> FYI, [Win + Shift + S] is quickest way in windows to copy selected area to clipboard, if that's all you need.

Nowadays (at least for me on Win11) it's also bound to the PRNTSCRN button, which is a nice way to redeem an otherwise anachronistic key.

MaxikCZ · a year ago
Thats the reason I stopped using win+shift+S, to draw on snippet right away. Now if only I could do 2 snippets and merge them into one pastable immage in flameshot..
xpil · a year ago
I'm a big fan of Greenshot. My only issue with it is that it's not available on Linux, which I use occasionally.

Re Flameshot, I've tried it and it generally works well for me. My only beef is that the layout of the icons around the captured area is dynamic, changing based on the shape and size of the area, requiring me to actively search for an icon instead of finding it in a static, predictable location.

weinzierl · a year ago
I worked for an organization with more than 150000 employees. All their PCs had Greenshot pre-installed and it was part of their standard software. Greenshot was used a ton over more than a decade, maybe still is, and (observed from my limited view) loved very much.

They never payed a cent to the developer - shame on them.

billwashere · a year ago
For the last 10(ish) years I've been using Greenshot [1]. I haven't found any issues with it but it is only available on Windows and Mac.

[1] https://getgreenshot.org/

winrid · a year ago
Greenshot is great! I use it on Windows, and ksnip on everything else atm as it has similar draw arrows/annotation features.
ASalazarMX · a year ago
If ksnip is cross-platform, may I ask why don't you use it everywhere, if it's so similar to Greenshot?

BTW I've never heard of Ksnip before. I gotta try it.

dang · a year ago
Related:

Flameshot v11.0.0 - https://news.ycombinator.com/item?id=30071766 - Jan 2022 (30 comments)

Flameshot – Simple, powerful screenshot tool for all major operating systems - https://news.ycombinator.com/item?id=26446070 - March 2021 (125 comments)

Flameshot – Superb Screenshot Tool - https://news.ycombinator.com/item?id=26113753 - Feb 2021 (83 comments)