Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'newbie': 0.05; 'subject:bug': 0.07; '"if': 0.09; 'below)': 0.09; 'modes': 0.09; '(just': 0.16; '24,': 0.16; 'given,': 0.16; 'mode,': 0.16; 'parameter.': 0.16; 'tuple': 0.16; 'typeerror:': 0.16; 'size,': 0.16; 'wrote:': 0.18; 'passing': 0.19; 'integer': 0.24; 'fine': 0.24; '(see': 0.26; 'skip:" 40': 0.26; 'switch': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; 'img': 0.31; 'trace': 0.31; 'file': 0.32; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'subject:?': 0.36; 'should': 0.36; 'changing': 0.37; 'list': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'disclaimer:': 0.60; 'color': 0.61; 'new': 0.61; "you're": 0.61; 'first': 0.61; 'back': 0.62; 'mar': 0.68; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=rGckVzx6X4X4aoyhIAfYtUkkbO/cH4NuAnrQr7LBbUc=; b=zYBfq9m90LufyZwLw+whzDyQqBOpXQuwD15ESvVnn4BPHi6K6dVr+l9QzBlF/zghOb dBHLE02ideqEPomZBr9m7JgNu/5IPGRhQBPQ4GS0ihzkkHP6pEuGbKWuz3aPI7WsFr7D VuMRyOkuskQ/8nLMO3iLA8DrfRHIlcjC0FVcISmCXOTicZfnN3ThOEkJjfqyG67CzOOp 3DEtnB3M2u2Ps75t0BoaG6MHPfS8uvAgEegUYBgB54NyAkRS3gFWmcyhyIX9fQ4Nk71z SnaWjjEOzv3cUsZAqRoHxaA9XZ4/U7sYMeSfIb0dKjBbGJTqEOqitHjfHAffsBMmE/Fz Ir/A== X-Received: by 10.68.110.195 with SMTP id ic3mr10811767pbb.124.1427228098908; Tue, 24 Mar 2015 13:14:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <80cb2142-1830-4216-9e9b-76b4f720071c@googlegroups.com> References: <80cb2142-1830-4216-9e9b-76b4f720071c@googlegroups.com> From: Ian Kelly Date: Tue, 24 Mar 2015 14:14:18 -0600 Subject: Re: Pillow bug? To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427228107 news.xs4all.nl 2956 [2001:888:2000:d::a6]:49111 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87905 On Tue, Mar 24, 2015 at 1:52 PM, wrote: > Judging from the message archive, the image-sig list is (just about) dead? > > Disclaimer: Am a newbie - so anything is possible > > > using 'RGB' works fine > > img = Image.new('RGB', (inktile[0], inktile[1]), bgcolor) > > using '1' or 'L' does not (see trace below) > > img = Image.new('L', (inktile[0], inktile[1]), bgcolor) > > > I change nothing else but the first parameter. If I switch the 'L' back to 'RGB' it works again. > > > img = Image.new('L', (inktile[0], inktile[1]), bgcolor) > File "C:\Python27\lib\site-packages\PIL\Image.py", line 2015, in new > return Image()._new(core.fill(mode, size, color)) > TypeError: an integer is required > > The docs say that '1' and 'L' are supported - something broken? Something I do not understand? What is the value of bgcolor that you're passing in? Per the docs: "If given, this should be a single integer or floating point value for single-band modes, and a tuple for multi-band modes (one value per band)." So if you're changing from a multi-band mode to a single-band mode, you would need to change the color argument as well.