PIL and line drawing

L

Leonard J. Reder

Hello,

I am using PIL to annotate some images with lines. I could not
find anyway to make the line that is drawn from the ImageDraw object
thicker. Does anyone have a suggestion or solution for solving this
without to much hacking?

Thanks for any replies,

Len
--
===================================
Leonard J. Reder
Home office email : (e-mail address removed)
Lab email : (e-mail address removed)
Lab web page : http://reder.jpl.nasa.gov
===================================
 
F

Fredrik Lundh

Leonard said:
I am using PIL to annotate some images with lines. I could not
find anyway to make the line that is drawn from the ImageDraw object
thicker. Does anyone have a suggestion or solution for solving this
without to much hacking?

if you have 1.1.5, you can use the width option to control
the line width. see:

http://effbot.org/imagingbook/imagedraw.htm
Thanks for any replies,

tip: you may get quicker/better responses if you use the
image-sig mailing list (if you're using a newsreader, point
it to gmane.comp.python.image)

</F>
 
R

rzed

if you have 1.1.5, you can use the width option to control
the line width. see:

I'm glad to see that addition. I was surprised to see that 'width'
is actually doubled in the resulting line, though. I suppose the
code adds and subtracts the specified width from the specified
coordinate point(?). I'd love to see width added to arc, circles,
etc., though if it is, I'd much prefer that it not be centered on
the coordinate point, but added only to the outer edge (or
subtracted from the inner edge); it would make placement much
easier, I'd think.

At the moment, whenever I need to generate thick-lined circles and
rectangles, I have to create a second image of the desired color,
then another mask image to contain a black rectangle (say) of the
required outer size, then within that a white rectangle of the
inner size, then use that mask to paste the color onto the original
image. The results are satisfactory, but the method seems clunky at
best. Maybe there's a better way. Even if this were the exact
method used, I'd rather see it automated in C than manually done in
Python.
 
F

Fredrik Lundh

rzed said:
I'm glad to see that addition. I was surprised to see that 'width'
is actually doubled in the resulting line, though. I suppose the
code adds and subtracts the specified width from the specified
coordinate point(?).

hmm. that sure sounds a lot like a bug I though I had fixed.

</F>
 
R

rzed

hmm. that sure sounds a lot like a bug I though I had fixed.
Ah, I see that I was using VERSION = "1.1.5b1" which I have now
upgraded to 1.1.5. Retesting ... nope, same thing. Specifying a
width of 10, I get a line of width 20. ImageDraw shows:

# $Id: ImageDraw.py 2134 2004-10-06 08:55:20Z fredrik $
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top