473,666 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7734
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********@cor nell.edu> wrote in message
news:J3******** ************@ne wssvr21.news.pr odigy.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********@cor nell.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************ ********@newssv r21.news.prodig y.com>, Andy C
<ay********@cor nell.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************ ********@newssv r21.news.prodig y.com>,
Andy C <ay********@cor nell.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********@cor nell.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********@cor nell.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

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

Similar topics

0
2249
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 didn't want it too. So I added the following attribute to my rectangles which solved the problem somewhat: antialias: false; On my monitor, the rectangles are drawn properly now, without anti-aliasing. However, when I print it to a printer, the
17
2271
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 revamped the anti-war quotes quiz: http://www.geocities.com/rgoya/javascript/PROTCODE.HTM#usaquiz Please feel free to
3
4275
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 anti-aliasing. Maybe there is some filter for it... Or can I write my own subroutine to do this in client-browsers?
6
1699
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 anti-SPAM solutions in the October 2005 edition. (PCW, for those who don't know it, is sort of the UK's equivalent of Byte Magazine, except that it's still publishing after almost 25 years). SpamBayes was one of two open-source apps in the group...
22
10754
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 anti-aliasing for small text from the css, or is there something else I can do to make small text more legible? (Note, the text really does have to be small, as that is what is required for the web-application. It is a system for use on screens...
1
1585
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. End of last year I installed the "long awaited" ASP.NET 2.0 + Web Application Studio Beta (MS) and my whole laptop installation went down the toilet, IIS and ASP.NET 1.1 did not work anymore and other things as well, now the machine is up to a...
0
1622
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? http://www.microsoft.com/athome/security/spyware/software/about/productcomparisons.mspx After the fun and games with WinXP SP2, I'm interested to know if anyone has had any problems with VS.NET 2005 in general, and ASP.NET 2 in particular...
1
11626
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 turn the anti-aliasing off so I get a nice blocky icon image? -- "I have nothing but the greatest respect for other peoples' crackpot beliefs". -- Sam the Eagle.
4
6802
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 breaking javascript it will break out of that frame and there is nothing you can do about it except to screenscrape. So I decided to challenge that, and I wrote a counter javascript that forces a page to stay in a frame. It worked after months of...
6
5558
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 opacity value of .8 and contain a background image. The effect is as expexted. However, the anti-aliasing is very poor in both Internet Explorer 7 and
0
8438
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.