473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

anti-aliased 2D vector graphics

Where can I get a python package to draw such figures? I googled and found
PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
converter or something. Is there any other alternative?

I have looked at PIL, but it doesn't seem to support drawing anti-aliased
figures. Thanks for any suggestions.

Andy
Jul 18 '05 #1
10 7704
Note that I'm on Windows... if there is some windows-specific solution, that
would be fine. I know there is a python win32 interface, and I think GDI
supports anti-aliased vector graphics, but I'm not sure. And fonts -- I
need to draw text too. Anyone tried that approach?

thanks,
Andy

"Andy C" <ay********@cornell.edu> wrote in message
news:J3********************@newssvr21.news.prodigy .com...
Where can I get a python package to draw such figures? I googled and found PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
converter or something. Is there any other alternative?

I have looked at PIL, but it doesn't seem to support drawing anti-aliased
figures. Thanks for any suggestions.

Andy

Jul 18 '05 #2
Hi,

pygame (www.pygame.org) can at least draw antialiased
lines. Look for the draw module in the documentation.

Udo
Jul 18 '05 #3
On Fri, 01 Aug 2003 07:57:29 GMT, rumours say that "Andy C"
<ay********@cornell.edu> might have written:
Where can I get a python package to draw such figures? I googled and found
PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
converter or something. Is there any other alternative?

I have looked at PIL, but it doesn't seem to support drawing anti-aliased
figures. Thanks for any suggestions.


Use PIL, and draw on an image twice the size (2*width, 2*height) as the
one you want. When you're done, resize the image --BILINEAR works fine
in this case.

You will need to draw thicker lines & arcs (I don't remember ATM if you
can use a <width> parameter with drawing methods)... create a custom
class to manage drawing double lines and arcs / circles when needed.
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
Jul 18 '05 #4
In article <Pi********************@newssvr21.news.prodigy.com >, Andy C
<ay********@cornell.edu> writes
Note that I'm on Windows... if there is some windows-specific solution, that
would be fine. I know there is a python win32 interface, and I think GDI
supports anti-aliased vector graphics, but I'm not sure. And fonts -- I
need to draw text too. Anyone tried that approach?

thanks,
Andy

ReportLab graphics does anti aliased bitmap drawing via libart_lgpl, but
I know it's not easy to get into.
--
Robin Becker
Jul 18 '05 #5
Andy C wrote:
Where can I get a python package to draw such figures? I googled and
found
PyX, I guess it outputs PostScript. I guess I can get a PostScript to
BMP
converter or something. Is there any other alternative?


One obvious solution would be to use GhostView to use PostScript to
generate an image, and then sample it down with a good resampling
library, like PNM.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ As far as I'm concerned, being any gender is a drag.
\__/ Patti Smith
Jul 18 '05 #6
<posted & mailed>

Andy C wrote:
Where can I get a python package to draw such figures? I googled and
found
PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
converter or something. Is there any other alternative?

I have looked at PIL, but it doesn't seem to support drawing anti-aliased
figures. Thanks for any suggestions.


In addition to the other suggestions made, you might want to consider
Sketch. It's normally billed as an application, but it's also a pretty
powerful drawing library for python. I'm uncertain about installation
issues, it may be a little harder to build on Windows than on Linux, (but
I suspect this is less of a problem if you just want to use it as a
library). But it certainly can do everything that you've mentioned.

I'm pretty sure that Sketch has anti-aliased rendering, but you should also
be aware that you can get pretty good results simply by oversampling -- I
usually draw at 4X the intended scale and then scale down by 1/4 to get the
final result. This is somewhat coarse, but it works pretty well visually.

See http://sketch.sourceforge.net/ and links therein.

Cheers,
Terry

--
Terry Hancock
Anansi Spaceworks http://www.AnansiSpaceworks.com/

Jul 18 '05 #7
In article <J3********************@newssvr21.news.prodigy.com >,
Andy C <ay********@cornell.edu> wrote:
: Where can I get a python package to draw such figures? I googled and found
: PyX, I guess it outputs PostScript. I guess I can get a PostScript to BMP
: converter or something. Is there any other alternative?

Sounds like a job for...SVG!

Here, have a look at this: http://www2.sfk.nl/svg

--Dave
--
"I had my first real beer (real meaning not sneaking it, or
the .5 crap), and amazingly enough, I wasn't immediately
surrounded by girls in bikinis. Go figure...."
-- Rob Hoadley
Jul 18 '05 #8
On Sat, 02 Aug 2003 01:43:50 GMT, rumours say that "Andy C"
<ay********@cornell.edu> might have written:

[SNIP: My suggesting double size images and then resizing]
Thanks for the suggestion, I think this will work fine for what I'm doing.
A little off topic, but is this how it is typically done? Is there a
special case for lines vs. fonts?


Font size should be doubled.
For lines, you *need* from 2 to 3 lines, but that involves some
math.atan2 style pre-calculations... (you can follow the easy way and
draw four lines as in the next paragraph.
For boxes, lines etc you better draw each 4 times
(x+0, y+0), (x+0, y+1), (x+1, y+0), (x+1, y+1)
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
Jul 18 '05 #9
On Sat, 02 Aug 2003 01:43:50 GMT, rumours say that "Andy C"
<ay********@cornell.edu> might have written:
A little off topic, but is this how it is typically done? Is there a
special case for lines vs. fonts?


Ah, *that* was your question (I was hasty in answering a few minutes
earlier).
I believe that yes, this is what is typically done for line art; but my
answer is not authoritative.
For fonts, I do not know for certain, although I know for certain that
this is what *I* have done in a simple "ClearType"-like-display text
reader I have written for reading texts in my Win2K notebook (I won't
bother installing XP *only* for the ClearType capability).
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
Jul 18 '05 #10
Dave Brown wrote:

Sounds like a job for...SVG!
I was going to say the same thing.

Here, have a look at this: http://www2.sfk.nl/svg


I'd say before a python wrapper, the first things to
look for are the open spec/doc at w3c, and a working renderer.
Given that svg is an xml language, I find a wrapper like
the one pointed at by your link, a bit paradoxical in the
sense that it's first selling point appears to be the
convenience of not seeing the xml representation while its
intrinsic documentation isn't sufficient for that purpose.

Jul 18 '05 #11

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

Similar topics

0
by: Jason | last post by:
Hi guys, I am having problems with VML. I had been working on a problem for sometime now, and I just recently discovered what the problem really was: VML was anti-aliasing my rectangles, but I...
17
by: rgoya | last post by:
Peace be with you! About a year ago, I created a JavaScript which turns any web site into an online anti-war protest: http://www.geocities.com/rgoya/javascript/PROTEST.HTM I have recently...
3
by: Michel | last post by:
Is there a way I can anti-aliasing a gif to be able to get a hi-quality resizeable backgroundpicture. When a GIF of JPG is being resized by the browser you get wurse pictures because it needs a...
6
by: Alan Kennedy | last post by:
Hi All, If there any contributors of SpamBayes reading, Congratulations! SpamBayes has won the Personal Computer World (pcw.co.uk) Editors Choice award for anti-spam software, in a review of...
22
by: Martin Eyles | last post by:
Hi, I have some text on a page in a small font. The font size has been OK in other applications, but in a web browser, the legebility suffers due to the anti-aliasing. Is there a way to turn off...
1
by: ~~~ .NET Ed ~~~ | last post by:
Hi, Are there any known bad interactions between an ASP.NET (1.1)/IIS installation and the MS Windows Anti-spyware Beta? I have a working XP Pro with ASP.NET and don't want to let it go to hell....
0
by: Mark Rae | last post by:
Hi, Just a general question, really... Is anyone here using any of Microsoft's latest anti-virus / anti-spyware software?...
1
by: John | last post by:
I have an app where I want to show an icon in a large PictureBox. I've set the SizeMode to Zoom but the icon image is extremely fuzzy because the scaling up also anti-aliases. Is there a way to...
4
by: Mike | last post by:
Hi, I took an interest a few months ago in an anti framebreaker javascript. All my research told me that it was impossible. If a website is loaded into a frame/iframe then if it has frame...
6
by: Roderik | last post by:
Hi, On my website I implemented tooltip alike layers when you hover the category items in the sidebar on the right. See: http://www.roderik.net/ The layers that become visible have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.