Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 672479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:29:22+00:00 2026-05-14T00:29:22+00:00

I recently saw someone with a T-shirt with some Perl code on the back.

  • 0

I recently saw someone with a T-shirt with some Perl code on the back. I took a photograph of it and cropped out the code:

alt text

Next I tried to extract the code from the image via OCR, so I installed Tesseract OCR and the Python bindings for it, pytesser.

Pytesser only works on TIFF images, so I converted the image in Gimp and entered the following code (Ubuntu 9.10):

>>> from pytesser import *
>>> image = Image.open('code.tif')
>>> print image_to_string(image)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pytesser.py", line 30, in image_to_string
    util.image_to_scratch(im, scratch_image_name)
  File "util.py", line 7, in image_to_scratch
    im.save(scratch_image_name, dpi=(200,200))
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1406, in save
    save_handler(self, fp, filename)
  File "/usr/lib/python2.6/dist-packages/PIL/BmpImagePlugin.py", line 197, in _save
    raise IOError("cannot write mode %s as BMP" % im.mode)
IOError: cannot write mode RGBA as BMP
>>> r,g,b,a = image.split()
>>> img = Image.merge("RGB", (r,g,b))
>>> print image_to_string(img)
Tesseract Open Source OCR Engine

     éi     _   l_` _ t  
  ’   ‘" fY`  
  {  W       IKQW
  ·  __·_  ‘ ·-»·      
       :W   Z  
  ··  I  A n   1   
           ;f        
     `    `      
`T     .' V   _ ‘  
I  {Z.; » ;,. , ;  y i-   4 : %:,,    
      `· »    V; ` ?    
‘,—·.    
H***li¥v·•·}I§¢   ` _  »¢is5#__·¤G$++}§;“»‘7·
  71   ’    Q  {  NH IQ
  ytéggygi {     ;g¤qg;gm·;,g(g,,3) {3;;+-
   § {Jf**$d$ }‘$p•¢L#d¤ Sc}
  »   i `  i A1:

That’s clearly gibberish that comes out of the OCR engine. So, my question is:

  • What do I have to do to get better OCR results out of Tesseract?
  • Or, does anybody else have better luck extracting the code from the above image in another way?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:29:23+00:00Added an answer on May 14, 2026 at 12:29 am

    You can probably type faster than you can clean up images and install OCR engines:

    #!/usr/bin/perl
    (my$d=q[AA                GTCAGTTCCT
      CGCTATGTA                 ACACACACCA
        TTTGTGAGT                ATGTAACATA
          CTCGCTGGC              TATGTCAGAC
            AGATTGATC          GATCGATAGA
              ATGATAGATC     GAACGAGTGA
                TAGATAGAGT GATAGATAGA
                  GAGAGA GATAGAACGA
                    TC GATAGAGAGA
                     TAGATAGACA G
                   ATCGAGAGAC AGATA
                 GAACGACAGA TAGATAGAT
               TGAGTGATAG    ACTGAGAGAT
             AGATAGATTG        ATAGATAGAT
           AGATAGATAG           ACTGATAGAT
         AGAGTGATAG             ATAGAATGAG
       AGATAGACAG               ACAGACAGAT
      AGATAGACAG               AGAGACAGAT
      TGATAGATAG             ATAGATAGAT
      TGATAGATAG           AATGATAGAT
       AGATTGAGTG        ACAGATCGAT
         AGAACCTTTCT   CAGTAACAGT
           CTTTCTCGC TGGCTTGCTT
             TCTAA CAACCTTACT
               G ACTGCCTTTC
               TGAGATAGAT CGA
             TAGATAGATA GACAGAC
           AGATAGATAG  ATAGAATGAC
         AGACAGAGAG      ACAGAATGAT
       CGAGAGACAG          ATAGATAGAT
      AGAATGATAG             ACAGATAGAC
      AGATAGATAG               ACAGACAGAT
      AGACAGACTG                 ATAGATAGAT
       AGATAGATAG                 AATGACAGAT
         CGATTGAATG               ACAGATAGAT
           CGACAGATAG             ATAGACAGAT
             AGAGTGATAG          ATTGATCGAC
               TGATTGATAG      ACTGATTGAT
                 AGACAGATAG  AGTGACAGAT
                   CGACAGA TAGATAGATA
                     GATA GATAGATAG
                        ATAGACAGA G
                      AGATAGATAG ACA
                    GTCGCAAGTTC GCTCACA
    ])=~s/\s+//g;%a=map{chr $_=>$i++}65,84,67,
    71;$p=join$;,keys%a;while($d=~/([$p]{4})/g
    ){next if$j++%96>=16;$c=0;for$d(0..3){$c+=
    $a{substr($1,$d,1)}*(4**$d)}$perl.=chr $c}
                 eval $perl;
    

    Edit: typo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently saw some Perl code that confused me. I took out all of
I recently saw some code that reminded me to ask this question. Lately, I've
I recently saw something interesting in some c++ code: try { //doStuff } catch
Recently I saw some code like this: <tr> <th> Some label: </th> <td> <input
In some code I saw recently there was a structure defined like this: typedef
Someone recently took a look of my code and commented that it was too
So I was recently looking at someone's code and I saw that the compiler
I recently saw the virtual mirror concept on you tube, I tried it out
I recently saw some XAML code that looked as follows: <Grid.ColumnDefinitions> <ColumnDefinition Width=2* />
i recently saw some videos on F#. it seems it used mainly for Service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.