You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script will take the selected are, same as when you take a screenshot of an area and retrieve the words from it, and output to terminal [silent] or copy to clipboard [copy] i selected language
tesseract use ocr engine and support many languages, just install sudo pacman -S tesseract tesseract-data-jpn /tesseract-data-eng
then download this script
and make a hyprland key binds
#image to text
bind = Super, Space, exec, ~/.config/scripts/image_to_text.sh copy eng # Image to text english copy to clipboard
bind = Super, Space, exec, ~/.config/scripts/image_to_text.sh silent eng # Image to text english output to terminal
#!/bin/bash
# Dependencies: grim, slurp, tesseract, wl-clipboard
# Usage:
# ./image_to_text.sh [copy|silent] [language]
# - copy: Copy the extracted text to clipboard
# - silent: Output the extracted text to the terminal
# - language: The language code for Tesseract (e.g., eng for English, spa for Spanish)
# Check if the correct number of arguments is provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 [copy|silent] [language]"
exit 1
fi
# Capture the screen area and save it as a temporary image
grim -g "$(slurp $SLURP_ARGS)" "tmp.png"
# Extract text from the image using Tesseract with the specified language
if [ "$1" == "copy" ]; then
tesseract -l "$2" "tmp.png" - | wl-copy
elif [ "$1" == "silent" ]; then
tesseract -l "$2" "tmp.png" -
else
echo "Invalid argument: $1"
echo "Usage: $0 [copy|silent] [language]"
rm "tmp.png"
exit 1
fi
# Remove the temporary image
rm "tmp.png"
The text was updated successfully, but these errors were encountered:
This script will take the selected are, same as when you take a screenshot of an area and retrieve the words from it, and output to terminal [silent] or copy to clipboard [copy] i selected language
tesseract use ocr engine and support many languages, just install
sudo pacman -S tesseract tesseract-data-jpn /tesseract-data-eng
then download this script
and make a hyprland key binds
The text was updated successfully, but these errors were encountered: