By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

How can I set polygon width in python?

P: 1
Hi All,

Here i am try to set polygon outline width but it give me error.

Expand|Select|Wrap|Line Numbers
  1. from PIL import Image,ImageDraw
  2. img = Image.new("RGB", (1024, 1024), "white")
  3. draw = ImageDraw.Draw(img)
  4. draw.polygon((924, 266, 245, 777, 241, 782, 306, 100, 924, 266), fill="white", outline="black")
  5. draw.polygon((924, 266, 245, 777, 241, 782, 306, 100, 924, 266), fill="white", outline="black")
  6. img_new_name="C:/example/Garpani_corrected.png"
  7. img.save(img_new_name, quality=90)
Sep 9 '15 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 613
It works fine for me. If the error is you only get one figure, that is because you draw two that are exactly the same, so the 2nd covers up the first.
Sep 9 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.