Path: csiph.com!au2pb.net!feeder.erje.net!2.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Why my image is in bad quality ? Date: Thu, 17 Dec 2015 01:33:36 +1100 Lines: 17 Message-ID: References: <424a0169-fe5b-4650-9673-46d265290c30@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de uSeNJHF/U4ZEpJ1O/7zK4wDoO7SVxhSQzlC6lz3awsfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'below)': 0.07; 'omit': 0.07; 'scaling': 0.07; 'cc:addr:python-list': 0.09; 'pil': 0.09; 'subject:Why': 0.09; 'argument': 0.15; 'thu,': 0.15; 'cleanly': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:image': 0.16; 'wrote:': 0.16; 'result,': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(see': 0.20; 'work,': 0.21; 'parse': 0.22; 'simpler': 0.22; 'am,': 0.23; 'dec': 0.23; 'second': 0.24; 'tried': 0.24; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'scale': 0.27; 'subject: ?': 0.27; 'message- id:@mail.gmail.com': 0.27; 'bad.': 0.29; 'code': 0.30; 'another': 0.32; 'received:google.com': 0.35; 'text': 0.35; 'something': 0.35; 'skip:i 20': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'skip:p 20': 0.38; "you'll": 0.61; 'more': 0.63; 'you.': 0.64; 'quality': 0.72; 'chrisa': 0.84; 'recognition': 0.84; 'subject:quality': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KXRU4I6vo6q/ZSTGeO8CZHkQ37CCmvsMRB4XHHJmYyA=; b=sV5JWdjlcDmE8FdLNhquuG+76oOL9mnoAi7B5s2VuFi7LTVJRj1IrrugG7NeF581Zx 4oayCi3ksZOrr2SmjsVbL9OM0onrR9E6rlAjK0V0fQPuOBOFkyeQjmiOJ4z2DE0cWimS PyWmTDnXZ5EwltnHWTOQUabk6whiBJBHYRlqcKINepnhB/mK29ohfvOkuzGZSzLobcu/ AAXgraYKoIVsOfiBj5R9zA9oBoOvPOMeQZ+B7auQHT9A7YrmQsVHlFBJha9rK746bSwv LB4TXCpKs+1PNGqBZfdCDZIw/dI4BjvTHL4QujPyflHusLvV/bhtM8NFoGzVkhkzzwdB U7QQ== X-Received: by 10.50.79.138 with SMTP id j10mr10891624igx.92.1450276416488; Wed, 16 Dec 2015 06:33:36 -0800 (PST) In-Reply-To: <424a0169-fe5b-4650-9673-46d265290c30@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100510 On Thu, Dec 17, 2015 at 1:21 AM, wrote: > I tried also another code (see below) and without scaling by 20 quality of recognition was very bad. > > from pytesseract import image_to_string > from PIL import Image > > im = Image.open("screen.png") > print(im) > im = im.resize((214*20,26*20), Image.ANTIALIAS) > print(image_to_string(im)) If you need to scale by 20x20 to get the text recognition to work, I would recommend using something other than an anti-alias filter. Omit the second argument to use a simpler algorithm; you'll get a blocky result, which might parse more cleanly for you. ChrisA