469,336 Members | 5,285 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

ImageDraw line inconsistent ? (repost)

Hi there,

Sorry to repost this, but I didn't get any answer one month ago. In
essence, it seems that the ImageDraw line function draws lines one
pixel shorter in some circumstances. This could be very annoying for
some applications where precise geometry does matter.

Below I test this function on a 3x3 image and show schematic
representations of obtained images (where o means a drawn pixel)

import Image, ImageDraw
im = Image.new("L", (3,3))
draw = ImageDraw.Draw(im)
draw.line((0,0,2,2), fill=255)
im.tostring()

Gives:

o--
-o-
---

So the last pixel of the line is not drawn.

Similarly, draw.line((0,2,2,0), fill=255) gives:

---
-o-
o--

And draw.line((1,0,1,2), fill=255) gives:

-o-
-o-
---

But, surprisingly, draw.line((0,1,2,1), fill=255) gives:

---
ooo
---

Where the last pixel of the line -is- drawn, as I expected it would be
for all lines.

This seems to be true for various image sizes and line angles: the last
pixel is never drawn unless the line is horizontal.

Any clues ?

Thanks

alex

Apr 7 '06 #1
1 1464
al***************@yahoo.com wrote:
Sorry to repost this, but I didn't get any answer one month ago. In
essence, it seems that the ImageDraw line function draws lines one
pixel shorter in some circumstances. This could be very annoying for
some applications where precise geometry does matter.


http://effbot.python-hosting.com/ticket/41

</F>

Apr 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Max M | last post: by
reply views Thread by alexandre_irrthum | last post: by
3 posts views Thread by Bob Greschke | last post: by
1 post views Thread by aljosa | last post: by
3 posts views Thread by Daniel Mark | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.