[Image-SIG] PIL floodfill?

Matthew Belk Matthew.Belk@noaa.gov
Tue, 21 Nov 2000 06:34:59 +0000


This is a multi-part message in MIME format.
--------------23F6FE548E2F1B20B375ED46
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello All,

I would first like to say that I am a complete fan of PIL.  I work for
the National Weather Service in Charleston WV.  Using PIL, I was finally
able to add some features to our web site like plotting polygons of
tornado warnings and the like.  This has made it much easier for the
users of our web site to get potentially life-saving information much
faster.  The WV Office of Emergency Services uses our site heavily as a
result.  Thank you Mr. Lundh!

That said, I was wondering if there is a flood fill feature in PIL?   I
am using PIL 1.0 with Python 1.5.2.  I have searched the PIL
documentation and these archives, but I must have missed something
somewhere.

What I am doing is taking an image of a state, complete with counties.
I would like to be able to fill in any of the counties with a color.  I
have already written a routine to do it point by point, but I am not
really happy with it since it fails on some of the more complex county
shapes.  It is also heavily dependent upon where you start filling in
the county.  I keep thinking there has to be a better way.

One idea I had was to find the border of a county and then redraw it as
a filled polygon.  Am I on the right track?  Any better ideas would be
appreciated.  I would like to distribute this software to other NWS
offices soon.

Thanks in advance,

Matthew Belk
Meteorologist NWS Charleston WV


--------------23F6FE548E2F1B20B375ED46
Content-Type: text/x-vcard; charset=us-ascii;
 name="matthew.belk.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Matthew Belk
Content-Disposition: attachment;
 filename="matthew.belk.vcf"

begin:vcard 
n:Belk;Matthew
tel;work:(304) 746-0180
x-mozilla-html:FALSE
org:NOAA;NWS
version:2.1
email;internet:Matthew.Belk@noaa.gov
title:Meteorogist - General Forecaster
adr;quoted-printable:;;400 Parkway Road=0D=0A;Charleston;WV;25309;
fn:Matthew Belk
end:vcard

--------------23F6FE548E2F1B20B375ED46--