473,563 Members | 2,884 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 4875
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.pyth on.image)

</F>

Jul 19 '05 #2
"Fredrik Lundh" <fr*****@python ware.com> wrote in
news:ma******** *************** **************@ python.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.pyth on.image)

--
rzed
Jul 19 '05 #3
"rzed" <je***@comics.c om> 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*****@python ware.com> wrote in
news:ma******** *************** **************@ python.org:
"rzed" <je***@comics.c om> 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
2717
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 another line, connecting User1's, and User2's current X,Y position. Same thing happens with User2. But User3, and User4 is not drawing, and see...
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 release the mouse button. I want to see the line when im drawing!! Im using the following code: Private Sub Picture1_MouseDown(Button As...
0
2751
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 images in the discussion. The idea is to easily add small drawings to the postings. The drawign tool should be easy to use and learn. It should...
9
2398
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 an exception to be thrown): This one works but it's not the results I want. private void CreateImage1() {
6
30642
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 draw a dotted line? Thank you.
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 cursor. I have tried many things, and I have mysterious things appening. Here, I can't remove the lines I have drawed :...
2
10398
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 the little program below I create two Regions: one is square, the other is a line. Hit testing works on the square-Region, not on the line-Region. ...
13
2380
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 appear as a dot. I can think of a way to define a 1-pixel long line but it is ugly and clumsy. I subtract .5 from the given pixel's X and Y...
2
3218
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 simple. Thanks MAtt -- Matt Campbell mattc (at) saunatec com
5
12859
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 g.DrawLine(..), but I have a lot of line. In C++ is a parameter XORPUT, but in C# I can't find it.
0
7664
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6250
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.