You remember documenting a website by taking screenshots. But how do you search by text?
- Image processing
- Command line interface
Keywords
How do you find text in images?
https://github.com/madmaze/pytesseract
from PIL import Image
import pytesseract
fname = './files/images/tess/nytimes.com.201506231100.jpg'
img = Image.open(fname)
print(pytesseract.image_to_string(img)))
The header. The styled text was poorly translated, including the New York Times logo. But everything else is legible. There’s a few spacing problems, US.
and NewYork
instead of U.S.
and New York
, respectively. It does capture the SHOP THE NEW COLLECTION
in the Cartier ad.
U.S. INTERNATIONAL
(;,,.,,-H. (7.l1)eNv21n flork Eimes (;,,.,,.(,,.
!.I.§.
Tuesday, June 23, 2015 El Today's Paper I4 Video 87°F Nasdaq 0.00% 1
World US. Politics NewYork Business Opinion Technology Science Health Sports Arts Style Food Travel Magazine Real Estate ALL
Q/we/«
L
(70//er/1'0/'1 P0/'/Lu bi/1-if’//’ ll?/gz/6
> SHOP THE NEW COLLECTION
The full result:
U.S. INTERNATIONAL
(;,,.,,-H. (7.l1)eNv21n flork Eimes (;,,.,,.(,,.
!.I.§.
Tuesday, June 23, 2015 El Today's Paper I4 Video 87°F Nasdaq 0.00% 1
World US. Politics NewYork Business Opinion Technology Science Health Sports Arts Style Food Travel Magazine Real Estate ALL
Q/we/«
L
(70//er/1'0/'1 P0/'/Lu bi/1-if’//’ ll?/gz/6
> SHOP THE NEW COLLECTION
The Opinion Pages
Senate Vote
Puts Trade Bill,
Obama Priority,
on Path to Pass
A crucial vote cleared the way
for legislation to be on the
president’s desk this week
giving him the power to
complete the Trans-Pacific
Partnership.
' 63 Comments
Renewed Campaigns
Against Confederate
Flag Across South
OP-DOCS
Op-Docs: ‘Who Sounds
Gay?’
This short
documentary
explores the reasons that some
men sound stereotypically gay,
whether they are or not.
~ Brooks: Fracking and the
Franciscans
~ Editorial: Take Down the
Confederate Flag
OP-ED CONTRIBUTOR
Why Women Apologize
and Should Stop
Women say ‘sorry? \, vi"!
too much, whether l,‘ A‘
they mean it or not. Why?
~ Taking Note: Skyrocketing
Extinctions Put Humans at
Risk
~ Op-Ed: A Republican Case for
Obama's Cuba Policy
~ Op-Ed: The Iran Deal’s Fatal
Flaw
A Woman on a $10 Bill? Readers Respond Eimcs
Disney Has No Comment on the Recent Reversal of
Layoffs
-;‘;‘i‘i'r.im’