Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.107 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; 'pil': 0.07; 'pixel': 0.07; 'pixels': 0.09; 'def': 0.10; 'received:195.186': 0.16; 'received:bluewin.ch': 0.16; 'wrote:': 0.17; 'define': 0.20; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'subject:end': 0.29; 'points': 0.29; 'probably': 0.29; 'point': 0.31; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'end': 0.40; 'your': 0.60; 'range': 0.60; 'email addr:gmail.com': 0.63; 'subject:\xe9': 0.65; 'subjectcharset:iso-8859-1': 0.67; 'received:ch': 0.69; 'color': 0.69; 'direct': 0.69; 'subject:color': 0.84; 'chapters': 0.93 Date: Wed, 06 Mar 2013 21:57:24 +0100 From: "F.R." User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: python-list@python.org Subject: =?ISO-8859-1?Q?Re=3A_draw_a_line_if_the_color_of_?= =?ISO-8859-1?Q?points_of_beginning_and_end_are_diff=E9rent_?= =?ISO-8859-1?Q?from_white?= References: <181dcc9d-eedf-429e-9307-a49303e9f7c9@googlegroups.com> In-Reply-To: <181dcc9d-eedf-429e-9307-a49303e9f7c9@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362603514 news.xs4all.nl 6881 [2001:888:2000:d::a6]:34126 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40662 On 03/06/2013 06:46 PM, olsr.kamal@gmail.com wrote: > how can i draw a line if the point of the begining and the end if those points are différent from the white > in other exepretion how can i get the color of two points of the begining and the end????? > please help me!!!! This should get you going. If it doesn't work it will still direct you to the relevant chapters in the tutorial. Frederic def draw_line (image): # image is a PIL Image ( ) # Define your colors WHITE = ~0 # Probably white for all modes. LINE_COLOR = 0 # define # Find end points points = [] pixels = image.load () # Fast pixel access for y in range (image.size [1]): for x in range (image.size [0]): if pixels [x, y] != WHITE points.append ((x, y)) # Join end points draw = ImageDraw.Draw (image) draw.line (points, fill = LINE_COLOR)