Sample Header Ad - 728x90

Tesseract doesn't accept process substitution

0 votes
1 answer
161 views
I'm making a quick script that is supposed to use OCR tool (tesseract) on image in clipboard to convert it to text and output it. It looks like this:
#!/bin/sh

temp="$(mktemp tmpXXX.png)"
xclip -selection clipboard -t image/png -o > $temp
tesseract $temp stdout 2>/dev/null
rm $temp
What I'm wondering is why doesn't this one-liner tesseract <(xclip -selection clipboard -t image/png -o) stdout work? From what I know, process substitution is supposed to make temporary file (similar to my full script) that tesseract uses as input file. Alas, this leads to an error:
Error in pixReadStream: Unknown format: no pix returned
Error in pixRead: pix not read
Error during processing.
Does anybody have an idea why this happens? Thanks in advance.
Asked by Fedja (125 rep)
Apr 4, 2022, 05:08 PM
Last activity: Apr 4, 2022, 06:10 PM