Path: csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'irc': 0.05; 'great.': 0.07; 'cc:addr:python-list': 0.09; 'creighton': 0.09; 'pil': 0.09; 'pil?': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'python': 0.10; 'python.': 0.11; 'things.': 0.15; 'apreciate': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'help...': 0.16; 'message-id:@fido.openend.se': 0.16; 'numpy': 0.16; 'opacity': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'regards!': 0.16; 'subject:image': 0.16; 'laura': 0.18; 'project,': 0.18; 'all,': 0.20; '2015': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'cc:2**1': 0.22; 'am,': 0.23; 'code.': 0.23; 'second': 0.24; 'sort': 0.25; 'script': 0.25; '(which': 0.26; 'helpful': 0.27; 'points': 0.27; 'fri,': 0.27; 'question': 0.27; '-0700,': 0.29; 'fork': 0.29; 'marc': 0.29; 'received:se': 0.29; 'subset': 0.29; 'cc:no real name:2**1': 0.29; 'tutorial': 0.29; 'there.': 0.30; 'option': 0.31; 'another': 0.32; 'especially': 0.32; 'maybe': 0.33; 'problem': 0.33; 'maintained': 0.33; 'worked': 0.34; 'add': 0.34; 'could': 0.35; 'done': 0.35; 'something': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'should': 0.36; 'needed': 0.36; 'there': 0.36; 'url:org': 0.36; 'lines': 0.36; 'heard': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'say': 0.37; 'charset:us-ascii': 0.37; 'doing': 0.38; 'several': 0.38; 'mean': 0.38; 'speak': 0.38; 'does': 0.39; 'along': 0.39; 'takes': 0.39; 'well.': 0.40; 'where': 0.40; 'some': 0.40; 'hang': 0.60; 'your': 0.60; 'hope': 0.61; 'skip:u 10': 0.61; 'header:Message-Id:1': 0.61; '(that': 0.63; 'improved': 0.63; 'more': 0.63; 'great': 0.63; 'you.': 0.64; 'hours': 0.65; 'remember,': 0.66; 'spend': 0.67; 'news': 0.68; 'hesitate': 0.71; 'eight': 0.72; 'channel,': 0.84; 'hand.': 0.84; 'header:In-reply- to:1': 0.84; 'plugin.': 0.84; 'sky': 0.84; 'this...': 0.84; 'working,': 0.84; 'worth,': 0.84; 'time)': 0.91; 'good,': 0.93 To: Marc Camacho Cateura cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: Copy polygonal subset of an image In-reply-to: References: Comments: In-reply-to Marc Camacho Cateura message dated "Fri, 28 Aug 2015 13:30:57 -0700." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16374.1440799922.1@fido> Content-Transfer-Encoding: quoted-printable Date: Sat, 29 Aug 2015 00:12:02 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Sat, 29 Aug 2015 00:12:04 +0200 (CEST) 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: , Newsgroups: comp.lang.python Message-ID: Lines: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1440799946 news.xs4all.nl 23814 [2001:888:2000:d::a6]:53948 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6798 X-Received-Body-CRC: 1811851987 Xref: csiph.com comp.lang.python:95748 In a message of Fri, 28 Aug 2015 13:30:57 -0700, Marc Camacho Cateura writ= es: >Hi all, > >For a project, I need to copy a polygonal subset of an image. I have eigh= t points of panoramic image, and I want to copy this subset onto another p= anoramic image. > >I find ways to do this with PIL but only with a box mask. And I need a po= lygonal subset from the eight points... > >I'm new in python and I don't know how to do this... maybe with numpy and= Pil? > >I apreciate some help... > >Thank you very much and best regards! Pillow is the maintained fork of PIL, but alas, it will not help you eithe= r as it really wants rectangles as well. For problems of this sort I use the GIMP. http://www.gimp.org/ If this is something you have to do with only a few images, and then you are done for good, just do it by hand. But if you need to do this regularly, the good news is that you can script the gimp with python. The bad news is that the documentation -- unless it has improved over the last 3 years -- is really incomplete. The other good news is that there is a gimp irc where helpful people hang out. irc://irc.gimp.org/#gimp-users The other question I have for you is, do you happen to speak French? irc://irc.gimp.org/#gimp-fr is perhaps even more helpful, and there is an extremely good 'scripting gimp with python' tutorial I remember, but I also remember it is in French. I have lost the link, alas, but I could go try to find it -- or you can ask in that channel, I think that is where I heard about it -- if this is an option for you. Note, before you try to write any plugin/script in python for the GIMP you should really spend several hours playing with the thing and manipulating images just for fun there. Not only to do what you want (which takes almost no time) but to get familiar with the gimp way of doing things. Otherwise any gimp-python tutorial is going to say 'first we need to add a second layer and we will set the opacity to ...' and you will be scratching your head and thinking 'what is a layer? what does it mean to have an opacity?' Hope this helps, But for what it is worth, I am _absolutely certain_ that you can do what you want with a python-fu (that is what they call it) plugin. I needed to take an set of images and chop them up into hexagons for a wargame I wrote, and it worked great. If that plugin hadn't gone to the great bit-bucket in the sky sometime in my year of destroying 4 laptops, I would just send you the code. While the people on the gimp irc are much more knowledgable than I am, do not hesitate to pester me for help to get your thing working, especially if you think your problem is more along the 'I think I am not understanding Python' lines than the 'I don't know how to make Gimp do this thing'. Laura Creighton