473,499 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PIL and line drawing

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 : re***@ieee.org
Lab email : re***@jpl.nasa.gov
Lab web page : http://reder.jpl.nasa.gov
===================================
Jul 19 '05 #1
4 4865
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>

Jul 19 '05 #2
"Fredrik Lundh" <fr*****@pythonware.com> wrote in
news:ma*************************************@pytho n.org:
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
Jul 19 '05 #3
"rzed" <je***@comics.com> 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>

Jul 19 '05 #4
"Fredrik Lundh" <fr*****@pythonware.com> wrote in
news:ma*************************************@pytho n.org:
"rzed" <je***@comics.com> 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
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2710
by: C. Alexander | last post by:
I'm making a 'whiteboard' application. I'm trying to have 2+ connected users able to draw at the same time. However, if User1 draws a line, when User2 is drawing, on User1 screen, it will draw...
1
6560
by: Dennis | last post by:
I started a new thread because i cant reply on the older one. Thank you very much Rick for the usefull reply. But i'v got another question. When drawing the line, you cant see the line untill you...
0
2738
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as...
9
2385
by: Steve Long | last post by:
Hello, (total GDI newbie) I'm having trouble drawing just a simple line to display in a picturebox. I just want a straight, dotdash line. I have two methods, one works and one doesn't (it cause...
6
30631
by: Rene | last post by:
I tried searching the newsgroups to see how do you draw a dotted line but I was unable to find an answer, drawing a straight line is very easy but not a dotted one. So the question is, how do I...
4
734
by: Mathieu Chavoutier | last post by:
Hi. I would like to do something like paint. I try to draw a line. I want, like paint, that when I clickdown, it begins to draw the line, and then, when I move the mouse, the line follow the...
2
10378
by: Martijn Mulder | last post by:
I want to know if the mouse is over (hitting) a line. Therefore I created a Region object that holds the line and use the IsVisible() method to test if the mouse hits the line. It doesn't work! In...
13
2366
by: Martijn Mulder | last post by:
I try to define a line with the length of 1 unit (1 pixel) that is, in fact, just a point on the screen. But when I draw it with a wide pen with the appropriate StartCap and EndCap (Round), it will...
2
3211
by: mattc66 via AccessMonster.com | last post by:
Does anyone know of some simple line drawing add-on apps. I just need to be able to do some simple line drawing with dims. 4 walls and a door and allow the user to type the dims for the walls. All...
5
12848
by: Macias | last post by:
Hi, Please help me, how I can make a line drawing on PictureBox similar to MS paint. I thinking about this: click and hold button, move mouse and relase button. I'm trying useing this...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.