PIL and line drawing

Discussion in 'Python' started by Leonard J. Reder, May 20, 2005.

  1. 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 :
    Lab email :
    Lab web page : http://reder.jpl.nasa.gov
    ===================================
     
    Leonard J. Reder, May 20, 2005
    #1
    1. Advertising

  2. Leonard J. Reder wrote:

    > 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>
     
    Fredrik Lundh, May 20, 2005
    #2
    1. Advertising

  3. Leonard J. Reder

    rzed Guest

    "Fredrik Lundh" <> wrote in
    news::

    > Leonard J. Reder wrote:
    >
    >> 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:
    >


    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.

    > 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)
    >



    --
    rzed
     
    rzed, May 20, 2005
    #3
  4. "rzed" <> wrote:

    > > 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(?).


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

    </F>
     
    Fredrik Lundh, May 24, 2005
    #4
  5. Leonard J. Reder

    rzed Guest

    "Fredrik Lundh" <> wrote in
    news::

    > "rzed" <> wrote:
    >
    >> > 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(?).

    >
    > 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 $

    --
    rzed
     
    rzed, May 24, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    686
    Kevin Spencer
    Jan 9, 2006
  2. kaushikshome
    Replies:
    4
    Views:
    822
    kaushikshome
    Sep 10, 2006
  3. defn noob
    Replies:
    1
    Views:
    434
    Mark Space
    Jun 28, 2008
  4. W. eWatson
    Replies:
    7
    Views:
    1,001
    W. eWatson
    Jan 29, 2009
  5. Sverre
    Replies:
    2
    Views:
    3,694
    Sverre
    Dec 17, 2009
Loading...

Share This Page